aleator / CV

Haskell wrappers and utilities for OpenCV machine vision library
http://hackage.haskell.org/package/CV
BSD 3-Clause "New" or "Revised" License
51 stars 13 forks source link

Fixed Image.getChannel not using the MutableImage with the relevant COI #44

Closed waldheinz closed 11 years ago

waldheinz commented 11 years ago

I think I fixed a problem introcuced with the MutableImage type, which causes the following error in OpenCV when using the getChannel function:

OpenCV Error: Assertion failed (src.channels() == dst.channels()) in cvCopy, file /builddir/build/BUILD/opencv-2.4.5/modules/core/src/copy.cpp, line 575
terminate called after throwing an instance of 'cv::Exception'
  what():  /builddir/build/BUILD/opencv-2.4.5/modules/core/src/copy.cpp:575: error: (-215) src.channels() == dst.channels() in function cvCopy

I think the problem is that the actual copy is made from the original image instead of the MutableImage where the COI has been set. The proposed change fixes the problem in my application, and in the provided "examples/channels.hs".

aleator commented 11 years ago

I've indeed fucked up there. Thanks for the fix!