Skip to content

Rewrite OpenCV code in C - #13

Merged
esteve merged 1 commit into
masterfrom
opencv-windows-title
Aug 26, 2015
Merged

esteve merged 1 commit into
masterfrom
opencv-windows-title

Conversation

@esteve esteve added the in progress Actively being worked on (Kanban column) label Aug 26, 2015
@esteve esteve self-assigned this Aug 26, 2015
@esteve esteve added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Aug 26, 2015
@dirk-thomas

Copy link
Copy Markdown
Member

Does the same apply to #12?

@esteve

esteve commented Aug 26, 2015

Copy link
Copy Markdown
Member Author

@dirk-thomas seems likely, should be easy to migrate #12 before merging it.

@esteve esteve mentioned this pull request Aug 26, 2015
4 tasks
@tfoote

tfoote commented Aug 26, 2015

Copy link
Copy Markdown
Contributor

+1

Comment thread image_tools/src/cam2image.cpp Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vrabaud

vrabaud commented Aug 26, 2015

Copy link
Copy Markdown

I don't understand why this is happening ...
I hope you guys have OpenCV 2.4.11 https://github.com/Itseez/opencv/releases/tag/2.4.11 (I believe there is no Windows installer for that on the download page).
If you have a tiny bit of time to investigate, I'd be curious to know whether it still happens when cvNameWindow is at the beginning.

C++ and C are normally interchangeable as they are replaced by one another (depending on the case).

@jackieokay

Copy link
Copy Markdown
Contributor

I'm a bit confused about the solution because the SO link you sent has no mention of the C API, but their solution was to add a magical preprocessor definition to the file. How did you arrive at this solution?

@esteve

esteve commented Aug 26, 2015

Copy link
Copy Markdown
Member Author

@jacquelinekay at first I used the suggestion posted on SO on a simple test program, but it breaks linkage on our binaries, as all symbols must be compiled with _ITERATOR_DEBUG_LEVEL=0. Then I figured out there must be something wrong in how std::string is encoded or interpreted in Windows/OpenCV, so given that the preprocessor flag just affects checked iterators, I opted to use the lowlevel C version of imshow and namedWindow which accept a const char * instead.

@esteve
esteve force-pushed the opencv-windows-title branch from 6d9e021 to ff17ff7 Compare August 26, 2015 16:36
@esteve

esteve commented Aug 26, 2015

Copy link
Copy Markdown
Member Author

@vrabaud thanks for your feedback. Yeah, this happens with OpenCV 2.4.11. I had to build it myself because we're using VS2015 (vc14), which is not available in the official binaries. I don't know if the official binaries are affected or it's just my setup, I can dig a bit deeper, but it'll have to wait until next week.

@jackieokay

Copy link
Copy Markdown
Contributor

it could be an issue with c_str() conversion, since that's the only difference between cv::namedWindow and cvNamedWindow:

https://github.com/Itseez/opencv/blob/2.4.11/modules/highgui/src/window.cpp#L156

though cv::imshow and cvShowImage follow different codepaths if you don't have OpenGL:

https://github.com/Itseez/opencv/blob/2.4.11/modules/highgui/src/window.cpp#L257

https://github.com/Itseez/opencv/blob/8869150649e32d8cd2285d7b5bc02b6e6d3becf9/modules/highgui/src/window_winrt.cpp#L60

Although I don't really want to refactor this and #12 to the C API, I agree with Esteve that this is a rabbit hole and could take an undefined amount of time to debug. In the interest of time we should take this solution.

@vrabaud

vrabaud commented Aug 26, 2015

Copy link
Copy Markdown

if it's in c_str(), can you actually narrow down by using cv::NamedWindow and not cvNamedWindow

@esteve

esteve commented Aug 26, 2015

Copy link
Copy Markdown
Member Author

I also tested encoding (http://en.cppreference.com/w/cpp/language/string_literal) the title string in UTF8, UTF16, etc. (thanks @jacquelinekay for the idea), and it still doesn't work. The only way I got this to work fine is with cvShowImage and cvNamedWindow

@esteve
esteve force-pushed the opencv-windows-title branch from ff17ff7 to f55117a Compare August 26, 2015 21:25
esteve added a commit that referenced this pull request Aug 26, 2015
@esteve
esteve merged commit 41aa944 into master Aug 26, 2015
@esteve
esteve deleted the opencv-windows-title branch August 26, 2015 23:22
@esteve esteve removed the in review Waiting for review (Kanban column) label Aug 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants