|
Re: Re: How to access pixels - urgent question: msg#01235lib.opencv
Or, if you prefer... uchar getPixel( IplImage*img, int lin, int col, int channel ) { return ((uchar*)(img->imageData + img->widthStep*lin))[col+channel] ; } Where channel is 0 to first channel, 1 to second, etc... Regards, Luiz Reginaldo Parameswaran <cegparamesh@xxxxxxxxx> escreveu: The FAQs would say it all... Suppose, we have 8-bit 3-channel image I (IplImage* img): I(x,y)blue ~ ((uchar*)(img->imageData + img->widthStep*y))[x*3] I(x,y)green ~ ((uchar*)(img->imageData + img->widthStep*y))[x*3+1] I(x,y)red ~ ((uchar*)(img->imageData + img->widthStep*y))[x*3+2] Regards, :D Paramesh. --- In OpenCV@xxxxxxxxxxxxxxx, "shadi_moudallal" <shadi_moudallal@...> wrote: > > Hi, > i think this code is great but i need it to work for multi channel > image. How can i use the iplgetpixel or if this code can be changed > to work for multi channel image. > thx > > --- In OpenCV@xxxxxxxxxxxxxxx, Luiz Curado <lutitus@> wrote: > > > > 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@> 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 --------------------------------- 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. --------------------------------- --------------------------------- Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora! [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: Video resolution: 01235, Kok Jun |
|---|---|
| Next by Date: | Re: Re: Products using OpenCV: 01235, Alejandro F. Reimondo |
| Previous by Thread: | Re: How to access pixels - urgent questioni: 01235, Parameswaran |
| Next by Thread: | Re: How to access pixels - urgent question: 01235, moezcherif2005 |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |