Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

How to set line width in face tracking #963

Open
2 tasks
sliontc opened this issue Oct 18, 2017 · 9 comments
Open
2 tasks

How to set line width in face tracking #963

sliontc opened this issue Oct 18, 2017 · 9 comments

Comments

@sliontc
Copy link

sliontc commented Oct 18, 2017

What would you like to submit? (put an 'x' inside the bracket that applies)

  • [x ] question
  • bug report
  • feature request

How can I set the line width when draw the rectangle marker in Camshift Face Tracking?

If you would like to submit an issue, please include a sample of the code you are trying to execute, as well as any data you might be using in your experiment, such as data tables, images, anything that might be necessary to reproduce the problem.

Note: If you would like to support the development for this feature or resolution of this bug, consider adding a bounty to it later in https://www.bountysource.com/teams/accord-net/issues

@blaisexen
Copy link

hi there,

as I understand you want to change or set the width or height or the rectangle?
if that, then here's the simplest sample I have,
http://www.mediafire.com/file/acyn37hihqodm3q/Accord.Face_Detection.zip

and here's the link I made an issue,
#456

@sliontc
Copy link
Author

sliontc commented Oct 19, 2017

Thanks for your reply, but I think you misunderstand me. What I mean is how to set the "line" width, the thickness of the line, not the size of rectangle. Since I want to customize the tracker marker.

@blaisexen
Copy link

hi,
I think you should use LineMarker instead of RectanglesMarker?

@sliontc
Copy link
Author

sliontc commented Oct 19, 2017

Actually, I have tried. But no result.

@sliontc
Copy link
Author

sliontc commented Oct 19, 2017

public static void Polyline(UnmanagedImage image, List points, Color color);
The definition is not mentioned about the line width.

@blaisexen
Copy link

Ok,
would you send your code of face detection project.

@cesarsouza
Copy link
Member

Hi @sliontc,

At this moment the RectanglesMarker class doesn't offer a width property to achieve this. However, adding support for this shouldn't be too difficult - if you are interested, I would accept pull requests implementing this change.

If you need to make only horizontal or vertical lines thicker (i.e. the borders of a rectangle), then the implementation should be straightforward. If, however, you would need to make lines at arbitrary angles thicker, then it would not be as simple.

But for the first case, maybe we can do as following:

  • First, we add a new overload for the Rectangle method in the Drawing class that can accept a width parameter:
    public static void Rectangle(UnmanagedImage image, Rectangle rectangle, Color color, int width)
  • Then, we can reuse almost exactly the same code as the original Rectangle function, except for the last part. In this part, instead of calling Line to do the job of drawing the lines on the image, we should change it to use FillRectangle, passing the rectangles that would represent the boundaries of the thick line we intend to draw (a thick line is just a very narrow and long rectangle).
  • Then, we will just have to add a new property to the RectanglesMarker class to register the width and call the new Rectangle overload we have just created instead of the previous one.

Regards,
Cesar

@sliontc
Copy link
Author

sliontc commented Oct 23, 2017

Great thanks for your tips. I will try to pull request.

@sliontc
Copy link
Author

sliontc commented Oct 23, 2017

@cesarsouza I just submit a pull request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants