Results 1 to 3 of 3

Thread: how to creating a selection mask out of an image? please help

  1. #1
    Join Date
    Apr 2010
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X

    Default how to creating a selection mask out of an image? please help

    hi, I'm having problem doing this project, i scoured web for help specific to my problem with no luck, the issue is that i did every thing using the designer and i dont know how to create simple thing like load an image in a scroll area and track mouse clicks to create a points then connect those points to create a mask for that image like in the example.

    selection_demons&#.jpg

    it seems like simple things to do for a professional programmer but not to me, i'm frustrated.

    this is the sample of my code
    Qt Code:
    1. QGraphicsScene *scene = new QGraphicsScene(this);
    2. scene->addPixmap(QPixmap::fromImage(image));
    3. ui->graphicsView->setScene(scene);
    To copy to clipboard, switch view to plain text mode 

    and the last screen shot is from the interface i did, how can i fill the x and y labels with updated mouse coordinates and when user clicks i can create a point then when he clicks again i can create other point and connect them with a line so finally i would end up with a black shape on a white background, that black shape would represent the part that needs to be removed from the original image at a later stage.

    selection_demons&#.jpg

    here is the screen shot of the interface, i used a QGraphicsView then put a QGraphicsScene with the image in it and it automatically shows scroll bars but when i want to save the image to a file using grabwidget the only saved part is the viewable part.

    Screen shot 2010-&#4.jpg

    any help is appreciated.

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: how to creating a selection mask out of an image? please help

    This cannot be done in designer in a graphical manner. You will have to write some code.
    It's nice to be important but it's more important to be nice.

  3. #3
    Join Date
    Apr 2010
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: how to creating a selection mask out of an image? please help

    thanks, my main problem was tracking mouse pos on a certian label or scene. i finally did it using QEventFilter.
    this topic was helpful: http://www.qtcentre.org/threads/6272...cking-on-image
    Last edited by Not Fast Enough; 12th May 2010 at 13:13.

Similar Threads

  1. Replies: 1
    Last Post: 12th May 2010, 13:12
  2. QLineedit mask
    By sudhansu in forum Qt Programming
    Replies: 11
    Last Post: 12th March 2010, 12:10
  3. Selection area on image
    By sdwdd in forum Newbie
    Replies: 2
    Last Post: 5th March 2009, 11:09
  4. MainWindow mask
    By SirBabyface in forum Qt Programming
    Replies: 0
    Last Post: 11th July 2007, 15:12
  5. Creating thumbnail of image through qt
    By vishal.chauhan in forum Newbie
    Replies: 1
    Last Post: 30th January 2007, 13:30

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.