Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/image_streamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@ cv::Mat ImageTransportImageStreamer::decodeImage(
cv::Mat_<float> float_image = float_image_bridge;
double max_val;
cv::minMaxIdx(float_image, 0, &max_val);

if (max_val > 0) {
float_image *= (255 / max_val);
}
return float_image;
} else {
// Convert to OpenCV native BGR color
Expand Down
8 changes: 7 additions & 1 deletion src/libav_streamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,13 @@ void LibavStreamer::sendImage(
first_image_time_ = time;
}

AVPixelFormat input_coding_format = AV_PIX_FMT_BGR24;
AVPixelFormat input_coding_format;
if (img.channels() == 1) {
img.convertTo(img, CV_32FC1);
input_coding_format = AV_PIX_FMT_GRAYF32;
} else {
input_coding_format = AV_PIX_FMT_BGR24;
}

AVFrame * raw_frame = av_frame_alloc();
av_image_fill_arrays(
Expand Down