Opencv highgui display window - c++

I installed opencv and ran few examples.. I can run simple image display program.. (http://docs.opencv.org/doc/tutorials/introduction/display_image/display_image.html ) The image window does not show the coordinates and rgb pixels values as in the this video. http://www.youtube.com/watch?feature=player_embedded&v=1OJEqpuaGc4. Do anybody know why and how to get the coordinates and rgb values at the bottom of the window as in the exmaple video...
Thanks

I figured out at last.. opencv library has to be compiled with qt rather than gtk

You can do it manually by using a mouse callback:
http://bsd-noobz.com/opencv-guide/45-3-using-mouse

Related

image doesn't change size if the window size was adjusted, openCV3.4.1_5 C++

I'm new to openCV and I'm using 3.4.1_5, C++ in Xcode on Mac. I used Homebrew to install opencv.
I'm following an openCV tutorial which is conducted in VS on Windows. Here's a link to the tutorial.
Basically, the tutorial shows how to create/resize a window, which is easy. So I have some code like this which is basically the same as in the tutorial:
#include "opencv2/opencv.hpp"
....
namedWindow("modi", CV_WINDOW_FREERATIO);
imshow("modi", modi);
resizeWindow("modi", modi.cols/2, modi.rows/2); //modi is a Mat
....
Supposedly, the image will be the same except it will be 1/4 of the original size and fit into the resized window. This is the case in the tutorial. However, it's not the case on my mac. My image stays the same size, and only the window shrinks to 1/4. If I drag the border of the window, the "covered" part of the image is revealed.
This actually poses a problem to my project later on, so I want to figure out why. I want to achieve what the tutorial achieves, and I've tried all window parameter, like AUTOSIZE, KEEPRATIO, OPENGL, etc. None of them worked. I'm thinking about if it's due to platform or version problem, but I have no way to test them.
Please help! Any hints would be greatly appreciated!

C++ displaying an image with SDL2 with different formats than .bmp

I am trying to display an image in SDL2 and the only guide I found was a guide about how to display a .bmp image. What I would like to do is displaying an image or setting a temporary image as a background. For example if I press LEFT_KEY the program should proceed to the next image. Any relevant guides or any examples you can share? It is not needed to set the image as a background (stretched), my goal is to display an image and being able to scroll through other images by pressing a key.
Use SDL_Image:
https://www.libsdl.org/projects/SDL_image/
Example:
Loading PNGs with SDL_image

Record mouse position with dlib

I am trying to draw a rectangle on screen with dlib. Does anyone know which object provides methods for recording mouse clicks/mouse position on a dlib window?
Take a look at drawable.h and see if it is what you are looking for, here's an example from the official documentation: http://dlib.net/dlib/gui_widgets/drawable.h.html.

gtk+ Image draw over image in c++

I would like to draw a simple (red) line over an image with gtkmm (in c++).
I have the image : Gtk::Image *image which is displayed in my window.
But I would like the line to change of position (I mean : draw another line) when a function is called. I need your help because I didn't find how to draw over an existing image...
Thank you for your help !
EDIT : A solution for me would be to overlay the image by an image with alpha channel... but I don't know how to to that :-/
You should not actually draw in the image, instead you draw in the window.
First put the image in the window (blitting or some other means) then draw the line.
See e.g. this link on how to draw straight lines.
Connect to the "expose-event" (GTK2) or "draw" (GTK3) signal of the GtkImage. I think you should use the C++ equivalent of g_signal_connect_after (which in in GObject), and not the g_signal_connect one, so you get a chance of drawing after the image has been drawn, so your drawing is on top of it. To draw you need to use cairomm, and Joachim already gave you a link to a cairomm tutorial.

how to change the background colour of CImage object in mfc?

I have an windows app which contains some dialogs. the dialogs have been built using mfc. I am drawing some images (.png) on every dialog using CImage::Draw() method. I want to mention that I am not using any picture contol on the dialog to render these images instead I am loading them at runtime using some handle.till this everything is ok. now when the image is loaded the background of those images are coming as white. the images in the resource file does not have the white background. my question is how to change the background of these images while drawing them on the dialog? I want the background of the image similar to the color of default dialog which i am using.
One more question the .png images are not rendering well(the images are scattered) in the dialogs of windows server 2008 R2 machine. what could be the possible remedy for this?
any help will be appreciated.
Your PNG images are obviously not 32-bit. You need an alpha channel and a transparent background. Open your images in e.g. Paint.NET. I bet your background is white there too! Regarding the image quality, are you stretching your images on draw?
Edit: For 8-bit imagers, I believe a call to SetTransparentColor is required. For 32-bit images, perhaps this function will do: TransparentBlt