Ask Your Question
0

Fatal error while converting image from rgb to gray

asked 2013-09-13 10:53:36 -0500

zulfiqar gravatar image

updated 2013-09-13 11:18:41 -0500

I am new to opencv . I am using cv::cvtColor(frame,frame,CV_BGR2GRAY); to convert rgb frame to gray but it gives linking error. All other basic functions eg reading and writing images and videos are working perfectly . Please help me which library I have to add

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-09-13 11:26:35 -0500

You cannot convert an image inplace if the number of channels is different. You have to use another matrix for that.

cv::Mat gray;
cv::cvtColor( frame, gray, CV_BGR2GRAY );
edit flag offensive delete link more

Comments

its giving an error newproject.obj : error LNK2019: unresolved external symbol "void __cdecl cv::cvtColor(class cv::_InputArray const &,class cv::_OutputArray const &,int,int)" (?cvtColor@cv@@YAXABV_InputArray@1@ABV_OutputArray@1@HH@Z) referenced in function _wmain

zulfiqar gravatar imagezulfiqar ( 2013-09-13 20:43:05 -0500 )edit

You have to link with imgproc library (opencv_imgproc).

Mathieu Barnachon gravatar imageMathieu Barnachon ( 2013-09-14 01:39:57 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-09-13 10:53:36 -0500

Seen: 554 times

Last updated: Sep 13 '13