Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

yes, there are a lot of arguments against your approach:

  • premature optimization (look it up)
  • you should not mess with cv::Mat's internal structure at all
  • your code is slower that Mat ::at()
  • this is not C, and your macro is messy

in general:

  • avoid per-pixel operations at all cost, in 90% cases, there's a high-level, optimized function for this already in opencv

  • get a row ptr(), and access the desired type directly, like explained here

  • don't try to be smart. don't try to be smarter than the devs.