필터 지우기
필터 지우기

Simulink - RGB to HSV block issue (V values seemingly corrupted)

조회 수: 3 (최근 30일)
Will
Will 2018년 3월 11일
편집: DGM 2022년 11월 9일
Hello!
I have MATLAB version 2017a, and I am using Simulink to do some video processing via a Raspberry Pi and a Raspberry Pi camera. I wanted to convert a video stream from RGB to HSV, and then threshold a particular range of HSV values to filter in only one color. I have accomplished this via a script, but I wanted to reproduce it in Simulink. Below is a picture of the piece of model in question:
And the results of this via the video viewers look like this (I cannot run all three screen due to this error: "Not enough memory on the target to process the packet: EXT_SELECT_SIGNALS"):
(H and S Screens):
(V value - just a white screen...):
For some reason, the V value is broken. It only outputs all 1's. Could anybody explain this problem? The RGB image works just fine, and so do the H and S values as seen.
Please answer ASAP! The solution to this problem is time sensitive.
  댓글 수: 2
Will
Will 2018년 3월 12일
I have done some more debugging, and I am certain the block is bugged. It would be nice if someone could confirm. What I have done is captured a image from the RPi camera, and used it in a simple model shown below:
This model, starting from the left, takes the constant image of dimensions 240x320x3 (where the 3 dimensions represent R, G, and B), converts it into type double (so it is compatible with the "Color Space Conversion" block), feeds into the RGB to HSV block, and the output is 240x320x3 matrix, where the 3 dimensions represent H, S, and V. The selector block then selects one of the H, S, and V matrices. When I selected the H and S matricies, it produced the expected outputs, as shown below:
However, the last image shows the V matrix:
The matrix is completely filled with 1's, or rather, 255's. However, this shouldn't be so I believe. Again, if someone could confirm, I would appreciate it.
Will
Will 2018년 3월 12일
Update:
I have tested the above comment's model on another laptop with MATLAB 2015a. The block works as expected. Possible bug in 2017a release?

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

채택된 답변

Stefano Arrigoni
Stefano Arrigoni 2022년 11월 9일
hello,
i verified that V matrix is in the range 0-255 so if you place a gain with 1/255 at the output of V and before video viewer it works properly (in Matlab 2022a at least)
Stefano
  댓글 수: 1
DGM
DGM 2022년 11월 9일
편집: DGM 2022년 11월 9일
If you feed an improperly-scaled image to the underlying conversion, it will return an improperly-scaled V, since V is just max(inpict,[],3). Casting a uint8 image as 'double' doesn't rescale it to the range expected for a floating-point image ([0 1]).
So yes, you're correct. You could rescale either before or after conversion, but in practice, I think it would be appropriate to rescale immediately after casting. Unless you're careful about how each thing handles improperly-scaled images, you run the risk of having unexpected problems like this.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Raspberry Pi Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by