Keep changes in an array (SIMULINK)
1 次查看(过去 30 天)
显示 更早的评论
Hey guys,
I want to fill a blank image iterative with ones. Most of it is done with matlab function blocks so far..
Example of my Problem/Idea: Let's say I have a binary image:
img = false([5,6]);
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
I have a signal which changes it's values and is the middle point of a (selfmade) rect:
dot = [3,2];
img(dot(1,1)-1:dot(1,1)+1, dot(1,2)-1:dot(1,2)+1)
0 0 0 0 0 0
1 1 1 0 0 0
1 1 1 0 0 0
1 1 1 0 0 0
0 0 0 0 0 0
I want to save it up, such that in the next step the old rect stays there, when dot changes to dot = [3,5]:
img(dot(1,1)-1:dot(1,1)+1, dot(1,2)-1:dot(1,2)+1)
0 0 0 0 0 0
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
0 0 0 0 0 0
And with next iteration, when dot changes to dot = [4,5]
img(dot(1,1)-1:dot(1,1)+1, dot(1,2)-1:dot(1,2)+1)
0 0 0 0 0 0
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
0 0 0 1 1 1
etc..
I want to update the image step by step.
In my model the rect changes every time the values of dot change...
the function in the model (image down below) creates a rect with size 8by12 with a middle point coming from the variable input. Everything else is like my example description. Incoming binary image (78x120) is not full blank but hast lot of spots with 1. You can see it as a map with objects, but zeros = blank space, ones = occupied.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/290787/image.png)
-
Is there a clever way to get this done in SIMULINK?
Thanks!
11 个评论
Walter Roberson
2020-5-6
Your question stated,
Let's say I have an false array full of zeros (or binary image):
If that is not the case, then you should be using the initial map as an input signal and you should be sending the signal back to the block with a suitable delay mechanism.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computer Vision with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!