GithubHelp home page GithubHelp logo

Comments (2)

fho306 avatar fho306 commented on June 30, 2024 1

I ran into this exact issue as well and found two ways to fix it:

A. Convert the image before rectification:
`cv::cvtColor(cv_img_raw->image, cv_img_debayer_->image, cv::COLOR_BayerBG"BGR);'
'cv_bridge_img_rect_->encoding = "rgb8";'

B. Publish the rectified image via image_transport instead of ros::Publisher*
See this pull request on the newer version of this driver:
basler/pylon-ros-camera#11
This is the better solution in my opinion, as it is still generic to image formats and I'd want to use image_transport for publishing images anyways.

Because of solution B I actually think the issue is that ros::Publisher* does not support the 'bayer_bggr8' encoding.

from pylon_camera.

schornakj avatar schornakj commented on June 30, 2024

I've run into this as well. In other CV applications a de-Bayering step is required before rectification to calculate the color values for each pixel from their compressed representation. I think the problem is that at line 521 in pylon_camera_node.cpp the raw image data is passed to rectifyImage without accounting for compression, which results in the loss of the compressed colors as the pixels get shifted around.

if ( getNumSubscribersRect() > 0 && camera_info_manager_->isCalibrated() )
{
cv_bridge_img_rect_->header.stamp = img_raw_msg_.header.stamp;
assert(pinhole_model_->initialized());
cv_bridge::CvImagePtr cv_img_raw = cv_bridge::toCvCopy(
img_raw_msg_,
img_raw_msg_.encoding);
pinhole_model_->fromCameraInfo(camera_info_manager_->getCameraInfo());
pinhole_model_->rectifyImage(cv_img_raw->image, cv_bridge_img_rect_->image);
img_rect_pub_->publish(*cv_bridge_img_rect_);
}

This might be tricky to fix while still keeping the node's image processing pipeline generic to image formats. One option would be to check the encoding at line 517 and convert to an uncompressed image format if needed.

from pylon_camera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.