You forgot to attach your image or screenshot. And you forgot to tell us what shaping and flag are. But it looks like this loop only adds to the blue channel so the red and green channel will stay as they were. To get it to show up as blue, you can't let the red and green stay as they were or else you'll just get a blue tint to the image. If you want pure blue you will have to set the red and green channels to zero in the same locations where you set the blue channel to 255.
Create a grid on an image
2 次查看(过去 30 天)
显示 更早的评论
Hello, this is my code:
for P = shaping
% Position beacon
img(1:n, 1:n,1+flag) = 255;
img(end-n:end, end-n:end,1+flag) = 255;
img(1:n, end-n:end,1+flag) = 255;
img(end-n:end,1:n,1+flag) = 255;
% We add the information only on the blue channel and add beacon
encodedBuffer(:,:,:,index) = frameBuffer(:,:,:,index);
encodedBuffer(:,:,3,index) = encodedBuffer(:,:,3,index) + ...
P*codeImage+img(:,:,1+flag);
index = index + 1;
end
I want to create some beacons on an image I have created, in which every time I enter this function (this loop belongs to a function) the value of flag will be changed to negative flag. Initially flag is 0. It creates the 4 squares inside the image but instead of being red or green it becomes blue (the image I'm adding it to is blue).
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!