Results 1 to 3 of 3

Thread: Displaying OpenCV Points using Qt

  1. #1
    Join Date
    Jul 2011
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Displaying OpenCV Points using Qt

    Hi,

    Using OpenCV, I have calculated image features, which are stored in a data structure of points. I have to display those point coordinates as circles on the image open in Qt.

    I am unable to convert the coordinates of the OpenCV points to Qt.

    This is how I am able to display the points in OpenCV (taken from the OpenCV codebook)

    Qt Code:
    1. void drawOnImage(cv::Mat &image, const std::vector<cv::Point> &points, cv::Scalar color= cv::Scalar(255,255,255), int radius=1, int thickness=1) {
    2. std::vector<cv::Point>::const_iterator it= points.begin();
    3.  
    4. // for all corners
    5. while (it!=points.end()) {
    6.  
    7. // draw a circle at each corner location
    8. cv::circle(image,*it,radius,color,thickness);
    9. ++it;
    10. }
    11. }
    To copy to clipboard, switch view to plain text mode 

    Now, I want to pass the const std::vector<cv::Point> &points to the mainwindow.h and then in mainwindow.cpp, using the coordinates of the points, print them on the Qt image using Qt Ecllipse tool.

    Anyone can help? Thanks!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Displaying OpenCV Points using Qt

    So what are the units of cv::Point? Pixels? Points? Fractions of image width? Megaparsecs? If a cv::Point describes a location in the image, there is certainly a conversion between that location and the corresponding location in the image after conversion to QImage or QPixmap.

    You will likewise need to convert "radius" from its units in cv-space to pixels in Qt image space.

  3. The following user says thank you to d_stranz for this useful post:

    imagyne (13th July 2011)

  4. #3
    Join Date
    Jul 2011
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Displaying OpenCV Points using Qt

    Done, thank you.
    Last edited by imagyne; 13th July 2011 at 15:27.

Similar Threads

  1. OpenCV + QT4
    By thereisnoknife in forum Qt Programming
    Replies: 6
    Last Post: 8th March 2013, 05:19
  2. Qt and OpenCV
    By malorie in forum Newbie
    Replies: 2
    Last Post: 7th March 2010, 14:57
  3. OpenCv & Qt4
    By switch in forum Qt Programming
    Replies: 0
    Last Post: 4th August 2009, 15:12
  4. OpenCv + Qt
    By Janderson Borges in forum Qt Programming
    Replies: 3
    Last Post: 2nd December 2008, 13:01
  5. Displaying tooltip for points in the graph
    By Ankitha Varsha in forum Qt Programming
    Replies: 4
    Last Post: 29th January 2008, 11:08

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.