기술 성공, 실패 기록소

decompress 16bit grey scale depth compressed image 본문

프로그래밍언어/ROS

decompress 16bit grey scale depth compressed image

sunlab 2021. 8. 20. 05:00
728x90

realsense camera 토픽 중

/camera/depth/image_rect_raw/compressed

/camera/depth/image_rect_raw/compressedDepth

위 두 토픽 중

 

/camera/depth/image_rect_raw/compressedDepth

를 사용한다. 위에건 fake이다.

 

decompress 16 bit grey scale은 opencv에서 제공하지 않는다.

opencv는 8 bit grey scalse 만 decompress 해줌

 

간단하게

http://wiki.ros.org/image_transport

 

image_transport - ROS Wiki

kinetic melodic noetic   Show EOL distros:  EOL distros:   electric fuerte groovy hydro indigo jade lunar diamondback: Only showing information from the released package extracted on Unknown. No API documentation available. Please see this page for in

wiki.ros.org

image_transport 를 사용하면 된다.

node 항목에 있는 명령어를 사용해서

 

rosrun image_transport republish compressedDepth in:=/camera/depth/image_rect_raw raw out:=/sun

위와 같은 식으로 쓰면 된다.

 

in, out에는 원형의 토픽을 넣어줘야 한다.

in 앞에 인자가 원형에 붙어서

/camera/depth/image_rect_raw/compressedDepth 토픽을 사용하는 셈.

 

http://wiki.ros.org/compressed_depth_image_transport

 

compressed_depth_image_transport - ROS Wiki

kinetic melodic noetic   Show EOL distros:  EOL distros:   fuerte groovy hydro indigo jade lunar fuerte: Documentation generated on December 28, 2013 at 05:06 PMgroovy: Documentation generated on October 06, 2014 at 12:47 AMhydro: Documentation genera

wiki.ros.org

compressed depth image transport 패키지는 image_transport 의 플러그인 패키지인데

''compressed_depth_image_transport works only with floating-point or 16-bit integer encoded depth images.''

위와 같이 친절하게 opencv에선 제공하지 않는, 16-bit integer encoded depth image를 decompress 해준다.

 

별도의 명령어가 필요한것이 아니라, image_transport 의 republish 노드를 사용할 때 인자로 compressedDepth가 있으면 자동으로 호출되서 사용되는 식.

 

+

cv_bridge does not properly support conversions for 16bit pngs

https://github.com/ros-perception/vision_opencv/issues/206

 

cv_bridge: CompressedImage conversions with 16bit grayscale images · Issue #206 · ros-perception/vision_opencv

I have 16bit grayscale images (mono16) and would like to convert to and from CompressedImage. It seems cv_bridge is not properly handling this case in most instances. Possibly related: image_transp...

github.com

compressed_imgmsg_to_cv2
http://docs.ros.org/en/lunar/api/cv_bridge/html/python/index.html
http://docs.ros.org/en/jade/api/sensor_msgs/html/image__encodings_8h_source.html

imdecode()
https://docs.opencv.org/3.4/d4/da8/group__imgcodecs.html#ga26a67788faa58ade337f8d28ba0eb19e
https://docs.opencv.org/3.4/d8/d6a/group__imgcodecs__flags.html#ga61d9b0126a3e57d9277ac48327799c80

'프로그래밍언어 > ROS' 카테고리의 다른 글

param과 args에 대해서.  (0) 2022.03.04
rosbag , topic 저장  (0) 2021.12.01
imdecode  (0) 2021.08.18
what is image step?  (0) 2021.08.18
remove package  (0) 2021.08.17