why my picture is 0s ?

1 view (last 30 days)
Bekhtaoui Abdelhakim
Bekhtaoui Abdelhakim on 21 Apr 2019
Answered: Geoff Hayes on 22 Apr 2019
I work on my project I have a problem
this is my program at the beginning i did it without the function structure then i wanted to put the function structure
as you see my function "my_sct" takes an image like input(image2 result from another program) and must give me an image (look workspace)
the problem is
when I run the program I see 0s and the picture result (output) is black
but when i use image2=imread('image2.jpg') to read the first output picture and i call my fonction "ma_sct(image2)" in commande window i have the correct result
so how to take the image from the first program without going through imread (from workspace)?

Answers (1)

Geoff Hayes
Geoff Hayes on 22 Apr 2019
Bekhtaoui - you say that the function "my_sct" takes an image like input(image2 result from another program). What does this other program do? Your screen shot shows that the data type of image2 is double. Does that perhaps mean that the elements of this matrix are in the interval [0 1] instead of [0 255] which is maybe what your code is assuming? I think that when you say that you use image2=imread('image2.jpg') to read the first output and that this works, it could be because the units/data type is uint8.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!