The two days of programming to achieve the same state filter, can achieve the results of my glasses, the image of the filter after a serious dislocation, can not distinguish the content of the image, check the program did not find errors, which let me have been very depressed. This morning in Baidu to search for a post, the post is someone else, but the original post author also encountered such errors. The author says an even-numbered picture doesn't happen, but a picture with an odd width will cause the error above. I also took a few pictures to experiment with, as the author said. The reason, originally is Iplimage widthstep in mischief, when width is even, widthstep and width*nchannels equal, but when width is odd, will fill a unit pixel length makes widthstep become even. Read the post, I also found the cause of the error, I immediately modify the program. Oh, the results are normal display. Just change the i*width+j of reading data to I*widthstep+j.
Reprint website: http://blog.csdn.net/myas0735/article/details/6939419
About the widthstep of Iplimage