From: ahoward <ah...@us...> - 2004-11-24 07:11:14
|
To get pixel data from an image, you just need to do a bit of pointer-bashing. E.g., off the top of my head: uint16_t pixel = *( ((uint16_t*) imagedata) + y * width + x ) gives the 16-bit integer value. Cast to float and divide by fdiv to recover the disparity value. A. ---------- Forwarded message ---------- Date: Tue, 23 Nov 2004 21:02:56 -0800 From: Kunihiko Igarashi <kig...@us...> Subject: Re: [Playerstage-users] Stereo Head Disparity Image Question Hello. I am really sorry for lacking such information. Here is my situation. I am trying to use stereohead camera to make an 3D map for my project. I have installed CVS version of gazebo and player 1.6. I was trying to write a player client in C++, and I was trying to use Camera Proxy for my problem to get disparity image and fdiv value. >From the documentation, I found that fdiv is not passed to Camera Proxy variable when Read() function is called, so I modified cameraproxy.cc file to pass fdiv value to camera proxy. Then, using this fdiv value and the disparity image data passed to the camera proxy, i was trying to calculate disparity value. Here, I got stuck. I believe the image data is in one dimentional array in row-major format, as you specified in your last message. The array size is 320*240*4, since I set the image size to 320*240. Also, the manual says that the image is in 16bit monochrome format. I somehow have to get value from this image and have to divide by fdiv to get real disparity value. I could figure out until this point. However, I do not know how to get float (or integer?) value from this image. How can I get disparity value (the value before I divide by fdiv) for one pixel from this 16bit monochrome formatted image?? I tried to find a way to solve this, but I could not... Am I missing any information???? If you know how to get this value, could you please teach me that? Also, I am getting a warning message when I try to Read() disparity image data. The warning says "WARNING: expected 1228813 bytes of camera data, but received 76813. Unexpected results may ensur." This warning only shows up when I try to read disparity image. I was wondering why, and if this will have any problem. Since I have not written much code yet, I will take your advise to use C for image processing and try to convert my code to C and will try again. Thank you for your time. Kunihiko Igarashi > > Hi Kunihiko: > > First, a tip: when posting a request like this, it is important to be very > specific about what you are doing and how you are doing it. Lacking these > details, it is hard to give you a clear answer. Having said that... > > Assuming you are have the latest release of both Gazebo and Player, which > client library are you using? If you are using libplayerc (recommended > for imaging), the disparity data will be read into the "image" member of > playerc_camera_t. The data will byte-aligned, in row-major format; divide > by fdiv to recover the pixel disparity (be careful to cast to a float > before dividing). > > BTW, if you are just doing a simple test, you dont need to use the Player > server; disparity data can be read directly from Gazebo using the > libgazebo interface. > > A. > > > > > On Mon, 22 Nov 2004, Kunihiko Igarashi wrote: > >> Hello. >> >> I am trying to get disparity information from the disparity image >> which StereoHead model returns. The disparity image is in 16bit >> monochrome image, and the manual says that I need to divide integer >> pixel value by 'fdiv', the scale divisor value stored in the >> player_camera_data, to recover the real pixel value. However, I do not >> know how to get each integer pixel value from this 16bit monochrome >> image. >> >> Could anyone help me?? >> >> Thank you. >> >> Kunihiko Igarashi >> > > Andrew Howard email: ah...@po... > Department of Computer Science http: > www-robotics.usc.edu/~ahoward > University of Southern California phone: 1 (213) 740 6416 > Los Angeles, CA, U.S.A. 90089-0781 fax: 1 (213) 821 5696 > << Insert pithy saying here >>> > > > > > > > > > > > > > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > Playerstage-users mailing list > Pla...@li... > https://lists.sourceforge.net/lists/listinfo/playerstage-users |