## Re: Re: [Playerstage-users] Stereo Head Disparity Image Question (fwd)

 Re: Re: [Playerstage-users] Stereo Head Disparity Image Question (fwd) From: Kunihiko Igarashi - 2004-11-26 07:53:55 ```Hi. Another questions. I am trying to calculate distance using disparity information from the stereo head camera. From my understanding, disparity is the x coordinate difference between a certain object position on the left camera image and the same object position on the right camera image. Both image should be at distance f (focal length) from the camera, and disparity value should be less than the base distance of left and the right camera. I hope I am saying the right thing. Please correct me if I am wrong... Then, to recover disparity information, I only need to divide data from disparity image by fdiv, right?? To find the disparity of the ith pixel of the image, we need to do disparity[i] = imagedata[i] / fdiv; I could get the ith pixel's imagedata using Andrew's method. I changed both imagedata and fdiv from network-byte-order to host-byte-order before calculation. Please correct me if I am doing something wrong at this point again. I became really confused at this point. First, what is the unit (e.g. m, cm, etc.) of the resulted disparity value. Is that in cm?? Second, I believed that the focal length of the camera (which I could not find) does not change. So, changing the size of the camera image (e.g. from 320*240 to 60*45) does not change the disparity value that much. However, as the size of the image becomes larger, disparity value I get using the method above becomes larger. For example, disparity value I got at one pixel by above method is 8 when the image size is 60*45, but becomes 42 if the image size is 320*240. This value is also larger than the base distance of the camera. Why is this happening?? Third, this is not really a StreoHead camera question, but is there an information about the focal length of the cameras?? Or is there any way to calculate it?? Could anyone please answer my question?? Thank you very much Kunihiko ```

 Re: [Playerstage-users] Stereo Head Disparity Image Question (fwd) From: ahoward - 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 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: ahoward@... > 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 > Playerstage-users@... > https://lists.sourceforge.net/lists/listinfo/playerstage-users ```
 Re: [Playerstage-users] Stereo Head Disparity Image Question (fwd) From: Kunihiko Igarashi - 2004-11-26 01:12:39 ```Hi. Thank you very much for your information. I could calculate disparity data. However, I have another problem. Using c++ Camera proxy, I can only get half data from the image. The data looks like below. I tried with different .world files, but I can only get top half data of the image. Is there any way to fix this?? Data: Disparity information calculated and printed row by row. The image only contains one object. 011111111111111111111111111111111111111111111111111111111111 011111111111111111111111111111111111111111111111111111111111 011111111111111111111111111111111111111111111111111111111111 011111111111111111111111111111111111111111111111111111111111 011111111111111111111111111111111111111111111111111111111111 011111111111111111111111111111111111111111111111111111111111 011111111111111111111111111111111111111111111111111111111111 011111111111111111111111111111111111111111111111111111111111 011111111111111111111111111111111111111111111111111111111111 011111111110004111111111111111111111111111111111111111111111 011111111110004444444433111111111111111111111111111111111111 011111111110004444444443333333311111111111111111111111111111 011111111110004444444443333333311111111111111111111111111111 011111111110004444444444333333331111111111111111111111111111 011111111100044444444444333333331111111111111111111111111111 011111111100044444444444433333331111111111111111111111111111 011111111100044444444444433333333111111111111111111111111111 011111111100044444444444443333333111111111111111111111111111 011111111100044444444444443333333311111111111111111111111111 011111111000444444444444444333333311111111111111111111111111 011111111000444444444444444333333311111111111111111111111111 011111111000444444444444444433333331111111111111111111111111 011111111000444444444444444433000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 ```
 Re: Re: [Playerstage-users] Stereo Head Disparity Image Question (fwd) From: Kunihiko Igarashi - 2004-11-26 07:53:55 ```Hi. Another questions. I am trying to calculate distance using disparity information from the stereo head camera. From my understanding, disparity is the x coordinate difference between a certain object position on the left camera image and the same object position on the right camera image. Both image should be at distance f (focal length) from the camera, and disparity value should be less than the base distance of left and the right camera. I hope I am saying the right thing. Please correct me if I am wrong... Then, to recover disparity information, I only need to divide data from disparity image by fdiv, right?? To find the disparity of the ith pixel of the image, we need to do disparity[i] = imagedata[i] / fdiv; I could get the ith pixel's imagedata using Andrew's method. I changed both imagedata and fdiv from network-byte-order to host-byte-order before calculation. Please correct me if I am doing something wrong at this point again. I became really confused at this point. First, what is the unit (e.g. m, cm, etc.) of the resulted disparity value. Is that in cm?? Second, I believed that the focal length of the camera (which I could not find) does not change. So, changing the size of the camera image (e.g. from 320*240 to 60*45) does not change the disparity value that much. However, as the size of the image becomes larger, disparity value I get using the method above becomes larger. For example, disparity value I got at one pixel by above method is 8 when the image size is 60*45, but becomes 42 if the image size is 320*240. This value is also larger than the base distance of the camera. Why is this happening?? Third, this is not really a StreoHead camera question, but is there an information about the focal length of the cameras?? Or is there any way to calculate it?? Could anyone please answer my question?? Thank you very much Kunihiko ```
 Re: Re: [Playerstage-users] Stereo Head Disparity Image Question (fwd) From: Kunihiko Igarashi - 2004-11-26 21:08:18 ```Hi Please ignore the question I posted below. That was my misunderstanding. I am sorry. Thank you Kunihiko ----- Original Message ----- From: "Kunihiko Igarashi" To: Sent: Thursday, November 25, 2004 11:53 PM Subject: Re: Re: [Playerstage-users] Stereo Head Disparity Image Question (fwd) > Hi. > > Another questions. > I am trying to calculate distance using disparity information from the > stereo head camera. > From my understanding, disparity is the x coordinate difference between a > certain object position on the left camera image and the same object > position on the right camera image. > Both image should be at distance f (focal length) from the camera, and > disparity value should be less than the base distance of left and the > right camera. > I hope I am saying the right thing. Please correct me if I am wrong... > > Then, to recover disparity information, I only need to divide data from > disparity image by fdiv, right?? > To find the disparity of the ith pixel of the image, we need to do > disparity[i] = imagedata[i] / fdiv; > I could get the ith pixel's imagedata using Andrew's method. > I changed both imagedata and fdiv from network-byte-order to > host-byte-order before calculation. > Please correct me if I am doing something wrong at this point again. > > I became really confused at this point. > > First, what is the unit (e.g. m, cm, etc.) of the resulted disparity > value. Is that in cm?? > Second, I believed that the focal length of the camera (which I could not > find) does not change. So, changing the size of the camera image (e.g. > from 320*240 to 60*45) does not change the disparity value that much. > However, as the size of the image becomes larger, disparity value I get > using the method above becomes larger. For example, disparity value I got > at one pixel by above method is 8 when the image size is 60*45, but > becomes 42 if the image size is 320*240. This value is also larger than > the base distance of the camera. Why is this happening?? > Third, this is not really a StreoHead camera question, but is there an > information about the focal length of the cameras?? Or is there any way > to calculate it?? > > Could anyone please answer my question?? > > Thank you very much > > Kunihiko > > > ------------------------------------------------------- > 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 > Playerstage-users@... > https://lists.sourceforge.net/lists/listinfo/playerstage-users ```
 Re: [Playerstage-users] Stereo Head Disparity Image Question From: Ryusuke Kodama - 2004-11-27 23:37:09 ```Hi. First of all, mr. Howard, thank you for replying my question about StereoHead Driver a long time ago. Since I don't know how to reply to the thread, I couldn't thank you. We have a question about disparity data. We try to get the data but it returns only top half of the image. The data of bottom half are always 0s. For example, if we have 360 x 240 pixel image, 360 x 120 pixels are all zero even though we can see some image there. We are using Gazebo 0.5, Player 1.6. and C++ Camera proxy. And our cfg file is following. If anyone has some ideas, please let me know. Thank you very much. Ryu Koadma driver ( name "gz_sim" provides ["simulation:0"] alwayson 1 ) driver ( name "gz_position3d" provides ["position3d:0"] gz_id "robot1" ) driver ( name "gz_camera" provides ["camera:0"] gz_id "userCam0" ) driver ( name "gz_stereo" provides ["left::camera:1" "right::camera:2" "left_disparity::camera:3"] gz_id "stereo1" ) ```