XBot | Swift Module for interacting with Xcode Bots | Code Editor library
kandi X-RAY | XBot Summary
kandi X-RAY | XBot Summary
Swift Module for interacting with Xcode Bots.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of XBot
XBot Key Features
XBot Examples and Code Snippets
Community Discussions
Trending Discussions on XBot
QUESTION
First off, sorry for the length of the post.
I'm working on a project to classify plants based on an image of the leaf. In order to reduce the variance of the data I need to rotate the image so the stem would be horizontally aligned at the bottom of the Image (at 270 degrees).
Where I am at so far...
What I have done so far is to create a thresholded image and from there find contours and draw an ellipse around the object (in many cases it fails to involve the whole object so the stem is left out...), after that, I create 4 regions (with the edges of the ellipse) and try to calculate the minimum value region, this is due to the assumption that at any of this points the stem must be found and thus it will be the less populated region (mostly because it will be surrounded by 0's), this is obviously not working as I would like to.
After that I calculate the angle to rotate in two different ways, the first one involves the atan2
function, this only requires the point I want to move from (the centre of mass of the least populated region) and where x=image width / 2
and y = height
. This method works in some cases, but in most cases, I don't get the desired angle, sometimes a negative angle is required and it yields a positive one, ending up with the stem at the top. In some other cases, it just fails in an awful manner.
My second approach is an attempt to calculate the angle based on 3 points: centre of the image, centre of mass of the least populated region and 270º point. Then using an arccos
function, and translating its result to degrees.
Both approaches are failing for me.
Questions
- Do you think this is a proper approach or I'm just making things more complicated than I should?
- How can I find the stem of the leaf (this is not optional, it must be the stem)? because my idea is not working so well...
- How can I determine the angle in a robust way? because of the same reason in the second question...
Here are some samples and the results I'm getting (the binary mask). The rectangles denote the regions I'm comparing, the red line across the ellipse is the major axis of the ellipse, the pink circle is the centre of mass inside the minimum region, the red circle denotes the 270º reference point (for the angle), and the white dot represents the centre of the image.
My current Solution
...ANSWER
Answered 2021-Apr-23 at 21:58Here's what I mean, and this needs to be refined. This draws an imaginary line through the image center every 5 pixels along the top edge, and then every 5 pixels along the left edge, adds up the pixel values on both sides of the line, and prints the min and max ratios. The fourth value of the tuple should be the angle of rotation.
QUESTION
I am attempting to speed up some code that I wrote but am having a large amount of trouble doing so. I know that being able to remove for loops and using numpy can help to do this so that is what I have been attempting with little success.
The working function without any speedups is
...ANSWER
Answered 2020-Apr-21 at 10:09Here is a vectorized form of your loop:
QUESTION
ANSWER
Answered 2019-Dec-13 at 00:15you can click on the character tab and select one of the default ones, including the default bots. Cheers!
Stefano - founder of Mixamo
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install XBot
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page