python – Detect contour into the method cv2.Circle

I am developing a project and would like a little help. I am using opencv + python for image processing, I use the Canny method to extract the edges of a can and I use findContour to draw the contours found by the Canny method …

I draw the outline found in the image, then create a circle using the cv.Circle method as shown in the image:

Image

The red circle is the circle created by the cv.Circle method.

The green circle is the outline found by the Canny method.

What I need now is to know if it is possible to identify whether any part of the green outline is into the red circle, is it possible to make this identification?

Script used:

gray = cv2.cvtColor (image, cv2.COLOR_BGR2GRAY)
gray = cv2.blur (gray, (3, 3))
edged = cv2.Canny (gray, canny1, canny1 * 3, kernel)
outline, hierarchy = cv2.findContours (edged, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
areas = (cv2.contourArea (contour) for contour in contour)
if areas:
    (contour, areas) = ​​zip (* sorted (zip (contour, areas), key = lambda a: a (1)))
    cnt = outline (-1)
    #print (areas)
    (x, y), radius = cv2.minEnclosingCircle (cnt)
    center = (int (x), int (y))
    radius = int (radius)
    circle = cv2.circle (image, center, radius - 10, (0,0,255), 2)
    circle = cv2.circle (image, center, radius + 10, (0,0,255), 2)
    cv2.drawContours (image, (outline (-1)), -1, (0, 255, 0), 2)
    cv2.imshow ('Canny Edges After Contouring', edged)
    cv2.imshow ('Contours', image)

sharepoint online – How to detect what the site template is in SPFx?

In SPFx modern sites, how can I detect what site template it is? In a shared tenant environment, I want to be able to be able to deploy them tenant wide, but disable them on certain sites (that are used by other organization). I was thinking of detecting them based on what site template is used. Anyone know?

Thanks

unity – How to detect which car T-boned the other in a collision?

The game has cars and collisions, and I’m trying to create the following system:

  • When a car T-bones another, the one getting T-boned is destroyed;
  • When the cars collide laterally (usually just bump into each other), a normal physics collision happens (and nothing is destroyed);
  • When the cars collide head-on, the lighter one is destroyed.

The cars are all instantiated from 1 prefab. This can’t be changed.

Car Setup

The main body sans the bumper has a normal, non-trigger collider and the dynamic Rigidbody. It has the tag “Destructible”.

A child object (which also houses the bumper model, but that shouldn’t matter) has a normal, non-trigger collider for the bumper. It has no Rigidbody and reports to the parent’s Rigidbody. It has the tag “Destroyer”.

1) The transform.forward solution

Get the transform.forwards of both cars and compute their dot product.

  • If the 2 vectors are opposite each other (or close to it), destroy the lighter car.
  • If the vectors are facing away from each other (or are close to parallel), let a normal collision happen.
  • If the vectors are perpendicular (or somewhere in that ballpark)… then I’m lost. How do I know which car T-boned which?

That brings us to the solution #2.

2) The ‘multiple colliders’ solution

Assign another collider to the bumper of the car and give it a separate tag (e.g. “Destroyer). As a consequence, give the other — main — collider a tag, too (e.g. “Destructible”).

  • If a Destroyer collider hits a Destructible, the latter is destroyed.
  • If a Destructible hits a Destructible, a normal physics collision happens.
  • If a Destroyer hits a Destroyer, destroy the lighter one.

But here, I run into an issue.

  1. You can’t have multiple colliders on the same game object. Ergo, create an empty child and attach it there. I won’t set it to Trigger, or otherwise it won’t detect collisions with another of its type (i.e. Destroyer).
  2. In order to destroy colliding objects, I need a script and an OnCollisionEnter() inside it.
  3. OnCollisionEnter() won’t run if neither of the game objects has a non-kinematic Rigidbody. This means I need to give the bumper colliders a non-kinematic Rigidbody.
  4. But if I give them dynamic Rigidbodies, they’ll just… float away from the car.

In other words, I need a way to create a 2nd collider but keep it firmly attached to the car. Furthermore, if the main collider covers it, then I need to exempt it from collisions with the 2nd collider (let’s call it the sub-collider), and I can’t use layers to do that or otherwise the sub-collider won’t detect main colliders on other cars.

If I don’t cover it, then I need the sub-collider to act as a normal physics collider, too, when it hits, for example, a wall, and not have the bumper sink into it. That means it needs a non-kinematic Rigidbody.

How can I solve this issue?

I’ve moved to a new domain for a long time. Why doesn’t Google Search detect the old one as redirection and make clean up?

My website is located at Quảcầu.cc. Another domain, Quảcầu.com, redirects to it.

I wonder why searching for site:Quảcầu.com yields different results with site:Quảcầu.cc? Shouldn’t Google detect that this domain is just a redirection and make a clean up? I have moved to the new domain for a long time.

In Google Search Console, both are domains property, but the Quảcầu.com property doesn’t seem to receive traffic anymore. Is it safe for me to request to remove results in Quảcầu.com without losing my rank?

How to detect "tree-able" set-families?

A set-family (a set of sets of elements) is called tree-able if the elements can be arranged on a directed tree such that each set in the family corresponds to a path from the root to a leaf. For example, the following family is treeable:

{ {1, 2, 6}, {1, 3, 4, 5, 6} }

A possible tree is:

1 -> 6 -> 2
     |
     + -> 3 -> 4 -> 5

However, the following family is not treeable:

{ {1, 2}, {2, 3}, {3, 1} }

Is it possible to decide in polynomial time whether a given set-family is treeable (and construct a tree)?

collision detection – How can I detect enclosed areas in an arbitrary set of overlapping lines

Hello and welcome to the site!

Here are some hindsights about how to construct a graph from your data:

  • The collisions are the nodes of your graph.
  • Each collision is bound to at least two lines (the two crossing, making the collision).

Then, each node is connected to all the others node having a line in common.

For example, the top collision in your image (let’s call it Node A) is bound to the two green lines. On the left green line, there’s another collision (Node B) with a pink line ; same thing on the right green line and another pink line (Node C). So we can start to build the graph with Node A being linked to Node B and Node C, since both of these two share a line with Node A (respectively the left and green ones). However, there is not link between Node B and Node C since they don’t share a line.
Now do the same with your other collisions, then apply the graph magic from the other post, and you’re done!

cqrs – How to detect broken indexes in Lucene?

I am the main author of Squidex, a headless CMS (https://github.com/squidex/squidex).

Squidex has a CQRS like architecture. So when you create a content a new ContentCreated event is created. An event consumer listens to all content events and populates lucene indexes.

Unfortunately there is only a single event consumer for the whole application and not one event consumer per project. But some installations include the Squidex cloud offering could have dozens to thousands of projects.

Lets say the user makes a search and does not retrieve the expected results. This could happen because somehow an event has been missed. Of course it would be a bug that an event is not handled by the event consumer, but if it happens it needs to be handled properly afterwards.

But I cannot just restart the event consumer, because then it would start from beginning for all events and projects. So it would be great if I can somehow detect that the index is very likely broken and just recreate this index. The question is “how?”. The index structure is not corrupt and the number of index entries could be correct, for example when an update event has been missed.

Of course I can also add something to the UI to recreate the full text index per project manually, but it would be great if it would just work.

In what ways site administrators can detect incoming CSRF attacks?

You implement a CSRF token on every vulnerable form. When there is a CSRF error, it is logged, so you “detect” it (do note that it might be a false positive, such as having cleared the cookies). If you protect from CSRF attacks, I don’t think it would be woth preparing such attack, as it won’t work.

You might do some checks based on Referer header, which could allow you to detect certain CSRF attacks. Although that depends on the browser and settings, if there’s no referer header (which could be suppressed by the attacking page on modern brower) you would receive no information.

hardware – Are there any smartctl similar tools to detect (eMMC/Nand) storage flash failure in advance on non-rooted android?

So far, I have two android phones which become kinda brick due to storage failure.

One phone suddenly missed many apps and files one day. And another one does not accept correct lock password one day.

When I try to look into mobie phone storage related topics, I am surprised that so litte info I can find.

I can not even find an app to tell what my phone’s storage type and model are. I tried the famous AIDA64, it doesn’t really give me anything about my flash drive. I can not even know if it’s a NOR, NAND or eMMC.

I have some/many mobiles and some are rooted and some are non-rooted. I am wondering if I can find a general solution to detect flash drive failure in advance so that I can backup properly before it failed to boot and lose data. (I use smartd/smartctl on desktop OS for this purpose)

From my bad experiences, I really don’t have any trust on mobile phone storage anymore. I have some other mobiles/pads/tablets broken too without knowinig what the real problem is. I guess they might be due to flash drive failutre as well.

Thank you very much for your help.

windows – How do I run a software(with VM detection capability) on a VM while ensuring the software doesn’t detect it’s being run on a VM?

Yeah, so I have this web browser(like SEB browser) application that claims it can detect when it’s in a virtual environment rather than a native one and would refuse to run properly on successful detection. Is there a bypass to this? In this case i’d like to alter perhaps the VM/OS and not the application itself. The VM is on-site and the application is only available on windows, macOS AND iOS. A solution for any of all of these platforms would do.