Create a grid on an image
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Image Analyst
on 3 Jul 2020
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.
0 Comments
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!