필터 지우기
필터 지우기

Keep changes in an array (SIMULINK)

조회 수: 2 (최근 30일)
Domi
Domi 2020년 5월 6일
편집: Domi 2020년 5월 7일
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.
-
Is there a clever way to get this done in SIMULINK?
Thanks!
  댓글 수: 11
Walter Roberson
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.
Domi
Domi 2020년 5월 6일
편집: Domi 2020년 5월 7일
Got it by myself. Thank you.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by