Author |
Topic |
ranjeetsingh_6
Posting Yak Master
125 Posts |
Posted - 2007-04-26 : 07:27:57
|
HiHiI am working on Biomatric Solution Project.I am using SecuGen BSP Device for This purpose.Device return Fingure image data in string .I want to display this Fingure image into Picture Box Control. For This I kept The output string in Byte array and then i write it in Memory Stream and at lastcreate a bitmap to display image(at this stage i got error "Parameter is Not Valid")Problem:-Code Give error when i create a bitmap to display image.red line show the error point.The error syntax is "Parameter is Not Valid".My Code is:- try { //Create Device API Interface object SECUBSPCOMLib.APIInterface objSecuBSP = new SECUBSPCOMLib.APIInterface(); long deviceID; objSecuBSP.EnumerateDevice(); //Open Device objSecuBSP.OpenDevice(2); string szFIRTextData; objSecuBSP.Enroll(null); //Get Data of Image(Fingure Print) into a string szFIRTextData = objSecuBSP.FIRTextData; //Get string into Stream Format means into Byte array from string byte[] arrBytes = new byte[szFIRTextData.Length]; int i = 0; foreach (char c in szFIRTextData.ToCharArray()) { arrBytes[i] = (byte)c; i++; } // Open a stream for the image and write the bytes into it System.IO.MemoryStream memStream = new System.IO.MemoryStream(arrBytes, true); memStream.Write(arrBytes, 0, arrBytes.Length); // Create a bitmap from the stream for Display it on Picture Box Control System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(memStream); pictureBox1.Image = bmp; memStream.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); }Ranjeet Kumar Singh |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-04-26 : 08:30:27
|
This part: //Get string into Stream Format means into Byte array from stringbyte[] arrBytes = new byte[szFIRTextData.Length];int i = 0;foreach (char c in szFIRTextData.ToCharArray()){arrBytes[i] = (byte)c;i++;} might be causing some issues; what datatype is szFIRTextData? A string? I am not sure that converting it to a char array, and then casting each char to a byte, will do the job for you. A char datatype is 16 bits.see: http://zone.ni.com/devzone/cda/ph/p/id/4It really doesn't make any sense at all to put binary image data as a string. To typically convert a string to an array of bytes, you'd use an encoding, like this:byte b[] = System.Text.Encoding.Unicode.GetBytes(yourstringhere);You can give something like that a shot, but I still am not sure it will work for you.- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-04-26 : 08:31:57
|
On a side note, since this is very technical and has absolutely nothing to do with databases, this is not really the place to be asking this type of question. You are much better off at a forum that specializes in C# or .NET.- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
ranjeetsingh_6
Posting Yak Master
125 Posts |
Posted - 2007-04-26 : 09:33:28
|
HiSince My Device return image data(Device Kept it in FIRFormate) into a string,Then i got image data in only this String.How can i save and display the picture image through this stringRanjeet Kumar Singh |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2007-04-26 : 09:48:25
|
This is a stab in the dark, but maybe it's what you want: a very common way to encode binary data in a string is base64. is your string base64 encoded? if so there are methods in C# for converting back to a byte array. have a look at System.Convert.FromBase64String()I have never heard of FIRFormat. I googled it and came up with nothing but typos and some norwegian and danish pages. www.elsasoft.org |
|
|
ranjeetsingh_6
Posting Yak Master
125 Posts |
Posted - 2007-04-26 : 10:35:47
|
hiyou are right may be you never heard of FIRFormat because this is depend on my Biomatric Device specefic.Can u tell me some goodC# forum site.Ranjeet Kumar Singh |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2007-04-26 : 11:01:19
|
I like http://www.codeproject.com but I don't know if they have forums. Jeff may have some he likes.I suggest you contact support for the maker of your device though. maybe the manufacturer has a forum? www.elsasoft.org |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
karuppaiya
Starting Member
2 Posts |
Posted - 2011-08-24 : 10:25:20
|
try{//Create Device API Interface objectSECUBSPCOMLib.APIInterface objSecuBSP = new SECUBSPCOMLib.APIInterface();long deviceID;objSecuBSP.EnumerateDevice();//Open DeviceobjSecuBSP.OpenDevice(2);string szFIRTextData;objSecuBSP.Enroll(null);//Get Data of Image(Fingure Print) into a stringszFIRTextData = objSecuBSP.FIRTextData;//Get string into Stream Format means into Byte array from stringbyte[] arrBytes = new byte[szFIRTextData.Length];int i = 0;foreach (char c in szFIRTextData.ToCharArray()){arrBytes[i] = (byte)c;i++;}// Open a stream for the image and write the bytes into itSystem.IO.MemoryStream memStream = new System.IO.MemoryStream(arrBytes, true);memStream.Write(arrBytes, 0, arrBytes.Length);// Create a bitmap from the stream for Display it on Picture Box ControlSystem.Drawing.Bitmap bmp = new System.Drawing.Bitmap(memStream);pictureBox1.Image = bmp;memStream.Close();}catch (Exception ex){MessageBox.Show(ex.Message);} |
|
|
karuppaiya
Starting Member
2 Posts |
Posted - 2011-08-24 : 10:27:35
|
Please help me some one i want capture thumb image and display image format in image control how can i do . |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2011-08-24 : 11:56:56
|
What's this got to do with SQL Data? Please read the FAQ's before posting. There are more useful websites for stuff like this. Try StackOverflow. |
|
|
|