Discussion:
Rectangular objects from client area
(too old to reply)
Jack
2010-02-01 21:26:10 UTC
Permalink
I ran into a nasty problem that I could not solve on top
of my thick head. So you might be able to help me.
Given a rectangle (rendered from a bitmap perhaps)
in the window client area, how can you find its
four corners coordinates, hence also finding its width
and height. I meant this is a bare minimal case without any
other further info despite of the only image on the
screen. It maybe easy, but I've pondered it for a long time already.
Thanks
Jack
Igor Tandetnik
2010-02-01 21:45:36 UTC
Permalink
Post by Jack
Given a rectangle (rendered from a bitmap perhaps)
in the window client area, how can you find its
four corners coordinates, hence also finding its width
and height.
When you say "given a rectangle" - what exactly are you "given"? What is the input for this problem?
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
Jack
2010-02-01 22:00:55 UTC
Permalink
Hi Igor,
I am on a rectangle partitioning problem. I want to
identify the 4 vertices of the rectangle on screen (window client area to be
more specifically).
First, I have a 3D model and I project it onto a 2D ground image. The 3D
model is created by our artist.
Next, I want to generate a navigation mesh based on the obstacles and empty
spaces available in the picture.
Thanks
Jack
Igor Tandetnik
2010-02-01 22:12:05 UTC
Permalink
Post by Jack
Hi Igor,
I am on a rectangle partitioning problem. I want to
identify the 4 vertices of the rectangle on screen (window client
area to be more specifically).
First, I have a 3D model and I project it onto a 2D ground image. The
3D model is created by our artist.
Next, I want to generate a navigation mesh based on the obstacles and
empty spaces available in the picture.
I'm not a graphics expert by any stretch, but taking a vector model, rasterizing it, then trying to discern vector information back from a raster image strikes me as a decidedly misguided approach. Can't you calculate the coordinates you want directly from the model?
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
Tamas Demjen
2010-02-02 22:05:53 UTC
Permalink
1) I have the large rectangle, this emcompasses 1,2,3,4,5 and the
obstacle in solid black
2) I Know each "large" rectangle is 200x200 pixels
3) Let say I divide the white spaces into 5 smaller rectangles as shown
I have a hard time understanding you, but I believe you want to say that
you have a bitmap, and you need to perform edge detection on it. So you
can run a gradient operator or Sobel filter, to find the edges in the
image:
http://en.wikipedia.org/wiki/Sobel_operator

In simple terms, the lines are where your pixels switch from black to
white.

And then run a Hough transform to detect the position and angle of your
lines:
http://en.wikipedia.org/wiki/Hough_transform
http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm
http://www.ddj.com/architect/184401736?pgno=10

This is very powerful. The combination of a Sobel filter and a Hough
transform lets you find the dominant lines even in a busy photograph.

There are other ways to detect lines as well. It's much easier if you
are sure that every line is either vertical or horizontal. I've
successfully used Hough transform techniques to detect black border in
scanned images.

I believe you should pick up a good image processing book from your
local library. Computer vision is not exactly on topic here at the
Microsoft C++ groups.

Tom
Tamas Demjen
2010-02-02 23:52:27 UTC
Permalink
Post by Tamas Demjen
can run a gradient operator or Sobel filter, to find the edges in the
http://en.wikipedia.org/wiki/Sobel_operator
Even better, the Canny edge detector:
http://homepages.inf.ed.ac.uk/rbf/HIPR2/canny.htm

Tom

Continue reading on narkive:
Loading...