04-13-2012 09:03 AM
hello i have to convert a 1D-array of bmp image data to binary and i dont know how to do that
grtz
04-13-2012 09:11 AM
Unless you are still using an old analog computer everything in a computer is already binary.
Please explain exactly want you want to see and we may be able to help.
But while we are waiting for clarification... the is a Picture palette that contains picture related functions including being able to read from file and others that you may find useful.
An please post images of your code (no VI's please) if you try them out and get stuck.
Ben
04-13-2012 09:23 AM
I have to covert a greyscale image to binary values, this is my implementation but i don't know if its correct
grtz
04-13-2012 09:27 AM - edited 04-13-2012 09:27 AM
This seems to be similar/same as this post. What you want to do by converting to 0s and 1s in that way? Any specific reason?
04-13-2012 09:31 AM
i have to convert image data to this type because we need to take the negative of a picture
04-13-2012 09:34 AM
You can also look into the vision modules there you have lot of advanced options that might be very helpful.
Good luck.
04-13-2012 09:40 AM
Maybe you can help me with converting an image to grayscale because i dont really think that i have done it right
04-13-2012 10:06 AM
I am not allowed to write the code but will outline something that may work.
The images are composed of pixels where each pixel is 4 bytes that represent the RGB (Red Green Blue) value of the pixel. The MSB is not used unless you are dealing with transparency or what-not so leeve the MSB as zero.
All colors that are grey have the property R=G=B.
So the challeng invloves mapping the RGB to valid grey-scale values.
An approach I have used takes the length of the vector RGB as if it is XYZ in 3-space. The length is simply the square root of the sum of the squares of the R, G, and B values. The vector lenght is then normalized to a max of 255 since the max bvalue a byte can have is 255.
TO get the negative you simply subtract the mapped value (0-255) from "255" and use that value for the RGB values.
Done.
Ben
04-13-2012 10:27 AM
The top right image in shown in this FP was derived from the top middle image using the method I outlined above.
Ben
04-13-2012 12:37 PM
@Ben wrote:
The top right image in shown in this FP was derived from the top middle image using the method I outlined above.
Ben
I remember my HOD who took DIP for us with this kind of very same explanation. 🙂