Reputation: 436
this is my problem: recently I learned something about code generation from Simulink model by Simulink Coder
. The model includes a MATLAB Function
block that converts from gray-scale video signal to binary using:
EDIT: Binary = im2bw(inputVideo, level);
because, for my application, I noticed that it is more accurate than Autothreshold
block (I do not why), but Simulink Coder
does not support im2bw
function (like you can see here http://www.mathworks.it/it/help/simulink/ug/functions-supported-for-code-generation--categorical-list.html#bsl0arh-1). So, I would try to create an outputVideo
using:
Binary = false(size(inputVideo)); % to inizialize
Binary(inputVideo>=threshold)==true;
...but when I do that with an grayscale image, outbinary
image is a full-black image. Is there a way to perform this conversion without using Autothreshold
block or im2bw
function ? Thanks in advance!
Upvotes: 1
Views: 857
Reputation: 36710
This line is wrong:
Binary(inputVideo>=threshold)==true;
Here you are comparing Binary(inputVideo>=threshold)
with true
. Correct:
Binary(inputVideo>=threshold)=true;
Upvotes: 3