![]() |
|
#1
|
|||
|
|||
Display pixel values of imageI have this function that displays the values of a binary image
CPP / C++ / C Code:
And since it's binary I thought it will only have two values and will only have 1 channel The above code displays values -1, -256, 0, 255. And since it only has 1 channel how come if I change the index [0] to [1] (or to any other number). It's still displays values. I thought It will go out of scope now since it only has 1 channel. Code:
Any help??? Last edited by LuciWiz : 17-Jun-2012 at 14:27.
Reason: Please insert your C++ code between [cpp] & [/cpp] tags
|
|||
|
#2
|
|||
|
|||
Re: Display pixel values of imageQuote:
That makes no sense to me. You have converted the image to grayscale (the OpenCV image type is CV_8UC1). The 8-bit pixel values are stored contiguously in an array of unsigned char. What the heck do you think would be accomplished by trying to access them as though they were elements of a 3-D vector of 16-bit integers? You can access the pixels of a CV_8UC1 image Mat in a number of ways. Perhaps the most convenient way would be CPP / C++ / C Code:
Of course, you don't actually need a separate value if all you are going to to is print out the pixel values: CPP / C++ / C Code:
Quote:
Successive byte values might be 0x00,0x00 or 0x00,0xff or 0xff,0x00 or 0xff,0xff Then, These will result in signed short integer values of 0, -256, 255, and -1, Quote:
Regards, Dave __________________
Sometimes I just can't help myself... Last edited by davekw7x : 17-Jun-2012 at 10:57.
|
|
#3
|
|||
|
|||
Re: Display pixel values of imageThanks davekw7x it's like your always online
|
Recent GIDBlog
Managing sshd Brute-force Attacks with iptables by gidnetwork
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to convert existing image to black and white? | kkmoslehpour | C Programming Language | 2 | 14-Oct-2011 16:19 |
| Displaying Pixel Values Of Bitmap Image | bharath1234 | C Programming Language | 4 | 27-Mar-2011 21:06 |
| NetBeans - Inventory Program | biglez123 | Java Forum | 1 | 23-Jan-2011 19:48 |
| Image display problem | Griff | Web Design Forum | 1 | 23-Aug-2004 17:47 |
| display image on tv monitor | Hood | Graphics Forum | 0 | 04-May-2004 16:21 |
Network Sites: GIDNetwork · GIDApp · GIDSearch · Learning Journal by J de Silva, The