|
Re: Re: How to access pixels - urgent question: msg#01194lib.opencv
So, lets go in that code... uchar getPixel( IplImage*img, int lin, int col ) { return ((uchar*)(img->imageData + img->widthStep*lin))[col] ; } - uchar is a unsigned char type (8 bits) - img is a pointer to my IplImage - lin, col are the line and column of the pixel - imageDate is an "array" that contains the pixels: first line, second line, etc, all in the same "array" - img->widhStep is the size of each line in my IplImage Now, it becomes more clear, dont? img->imageData + img->widthStep*lin => With this piece of code, i'm in the beggining of line "lin" <my line>[col] ; => With this piece of code, i'm in the column "col" of line "lin" I hope this can help. :) Regards, Luiz Reginaldo evaspies <evaspies@xxxxxxxxx> escreveu: Hi Luis, thanx for your help. But I dont quite understand this! can you please comment that code?` Thnx a lot --- In OpenCV@xxxxxxxxxxxxxxx, Luiz Curado <lutitus@...> wrote: > > Hi, > > Try this: > > uchar getPixel( IplImage*img, int lin, int col ) { > return ((uchar*)(img->imageData + img->widthStep*lin))[col] ; > } > > void setPixel( IplImage*img, int lin, int col, uchar valor ) { > ((uchar*)(img->imageData + img->widthStep*lin))[col] = valor ; > } > > Regards, > > Luiz Reginaldo > > evaspies <evaspies@...> escreveu: > Hi guys. > > Im trying to access Pixels of a grayscale image to get a > representantive value. best of all would be if the value lies > between 0 für black and 255 für white. > Do you have an Idea? > I tried to use iplGetPixel, but that function is only for 3 or 4 > channel pictures. > > Thanx for xour help! > > > > > > > Change settings: http://www.yahoogroups.com/mygroups, select > Get Emails (get all posts) > Daily Digest (one summary email per day) > Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe@xxxxxxxxxxxxxxx > > > > > SPONSORED LINKS > Open source software Computer vision > > --------------------------------- > YAHOO! GROUPS LINKS > > > Visit your group "OpenCV" on the web. > > To unsubscribe from this group, send an email to: > OpenCV-unsubscribe@xxxxxxxxxxxxxxx > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. > > > --------------------------------- > > > > > > --------------------------------- > Yahoo! doce lar. Faça do Yahoo! sua homepage. > > [Non-text portions of this message have been removed] > Change settings: http://www.yahoogroups.com/mygroups, select Get Emails (get all posts) Daily Digest (one summary email per day) Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe@xxxxxxxxxxxxxxx --------------------------------- YAHOO! GROUPS LINKS Visit your group "OpenCV" on the web. To unsubscribe from this group, send an email to: OpenCV-unsubscribe@xxxxxxxxxxxxxxx Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --------------------------------- --------------------------------- Yahoo! Messenger com voz - Instale agora e faça ligações de graça. [Non-text portions of this message have been removed] Change settings: http://www.yahoogroups.com/mygroups, select Get Emails (get all posts) Daily Digest (one summary email per day) Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe@xxxxxxxxxxxxxxx |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: How to access pixels - urgent question: 01194, evaspies |
|---|---|
| Next by Date: | Re: homography matrix: 01194, Sinan |
| Previous by Thread: | Re: How to access pixels - urgent questioni: 01194, evaspies |
| Next by Thread: | How to do interpolation?: 01194, Rafael Nevarez |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |