imread(argv[1]) and imread(argv[1],CV_LOAD_IMAGE_ANYDEPTH) gives different channel [closed]

asked 2018-06-02 00:51:59 -0500

Kenny Karnama gravatar image

Hi guys, i am still confused why imread without CV_LOAD_IMAGE_ANYDEPTH gives different result with imread with CV_LOAD_IMAGE_ANYDEPTH option. Am i missing something ? Thanks.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Kenny Karnama
close date 2018-06-02 04:32:31.527632

Comments

add a more specific example, please.

berak gravatar imageberak ( 2018-06-02 01:16:51 -0500 )edit
1

I'm agree :

Mat im = imread("g:/lib/opencv/samples/data/fruits.jpg");
Mat imd = imread("g:/lib/opencv/samples/data/fruits.jpg", IMREAD_ANYDEPTH);
cout << "default value : " << im.channels();
cout << "\nIMREAD_ANYDEPTH : " << imd.channels();

Results :

default value : 3
IMREAD_ANYDEPTH : 1

Bug in Doc or bug in code ?

Write an issue

LBerger gravatar imageLBerger ( 2018-06-02 02:25:10 -0500 )edit
1

okay, i have already written an issue in opencv

Kenny Karnama gravatar imageKenny Karnama ( 2018-06-02 02:38:42 -0500 )edit

bug.

gdb shows, we go here (in the 2nd case)

if( (flags & CV_LOAD_IMAGE_ANYDEPTH) == 0 )

that should be

    if( (flags & CV_LOAD_IMAGE_ANYDEPTH) != 0 )

???

berak gravatar imageberak ( 2018-06-02 02:48:48 -0500 )edit

@Kenny, where 's the issue ? i can't see anything

berak gravatar imageberak ( 2018-06-02 02:52:10 -0500 )edit
1

May be IMREAD_ANYDEPTH cannot be used alone and flag must be IMREAD_ANYDEPTH|IMREAD_COLOR or IMREAD_ANYDEPTH|IMREAD_GRAYSCALE

@Kenny my issue link was wrong : https://github.com/opencv/opencv/issues

LBerger gravatar imageLBerger ( 2018-06-02 03:24:02 -0500 )edit

^^ imho, that is the correct answer.

berak gravatar imageberak ( 2018-06-02 03:44:39 -0500 )edit
1

thanks guys. sorry for the confusion.

Kenny Karnama gravatar imageKenny Karnama ( 2018-06-02 04:31:07 -0500 )edit