What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
A five-corner label can break an OpenCV capture loop when the program is using an ArUco detector, because ArUco is designed to accept square markers with four corners. The apparent “capture” failure is usually a detection or error-handling problem: a truly pentagonal label is rejected as the wrong geometry, while a square label that appears to have five corners usually has a broken border, poor thresholding, perspective distortion, or an edge-of-frame artifact.
First determine which case you have. Save the raw frame and thresholded image, inspect rejected contours, verify the dictionary and border, and make the loop tolerate frames with no valid IDs. If the physical label must remain five-sided, use a polygon-specific contour pipeline instead of trying to loosen ArUco until it accepts a pentagon.
As an Amazon Associate I earn from qualifying purchases.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Why does OpenCV reject a five-corner label?
ArUco detection is a square-fiducial pipeline, not a general shape detector. The detector thresholds the image, finds contours, approximates each contour as a polygon, and keeps candidates that approximate a square. OpenCV’s documentation states that “a polygonal approximation is applied to each candidate and only those that approximate to a square shape are accepted” (OpenCV’s ArUco detection documentation).
An accepted marker therefore exposes four image points in a defined order: top-left, top-right, bottom-right, and bottom-left when viewed in the detector’s coordinate convention. A contour with five vertices is not a valid ArUco candidate. The detector may place it in the rejected-candidate output, or it may discard it before decoding. Changing an approximation tolerance cannot turn a genuinely pentagonal object into a square coded marker.
Popular on Amazon
- 【90 Degree Full Function USB C Adapter】Supports the latest USB4 standard for up to 40Gbps of bandwidth, 8K video support, and up to 240W Fast charging; Support USB PD 3.1 Extended Power Range (EPR) including 140W, 180W and 240W. Your productivity is easily doubled. *Warm Tip: For the best fit, please make sure the USB-C port is fully exposed; thick or bulky cases may affect compatibility.
- 【Reliable Quality】Made from high-quality, scratch-resistant aluminum alloy, delicate metal frame. get excellent wear resistance and heat dissipation. Non-Slip Design for easier insertion and removal.
- 【Small and portable】Ultra thin size, ultra compact design, a petite physique that matches the minimalist design of your modern laptops. Coming with a slim figure that won't block the port next to the one it's plugged into.
- 【Compatibility】Widely work with most usb c, thunderbolt 4/3 devices. Compatibilit for ROG Ally, Steam Deck, Switch, MacBook Pro, Quest 3 VR headset, Surface Book 2, iPhone 18/17/16/15, Samsung Galaxy S23/S22/S21, Note 20/10, Google Pixel, ChromeBook, etc.
- 【Excellence Customer Support】If you experience any issues or cable failure, simply reach out to our dedicated customer service team. We provide a prompt response within 18 hours, providing you with the necessary technical support to resolve any concerns.
There are two different failure modes:
- The label is physically pentagonal. This is a data-model mismatch. Use a contour pipeline that explicitly supports five-sided polygons, or replace the label with a square fiducial.
- The label is square but the image produces five vertices. The black border may be broken by adaptive thresholding, glare, blur, compression, occlusion, or a nearby contour. Parameter and lighting changes can sometimes restore a four-vertex candidate.
Do not assume that the camera stopped merely because no marker was decoded. A normal frame can be acquired successfully while ids is empty. A loop that immediately indexes IDs or corners without checking for that condition can throw an exception and look like a capture failure.
What should a reliable OpenCV capture loop do?
The camera loop should validate frame acquisition before detection, preserve rejected candidates during diagnosis, and process IDs only when a valid detection exists. The documented pattern is:
cap = cv2.VideoCapture(0)
while True:
ok, frame = cap.read()
if not ok:
break
corners, ids, rejected = detector.detectMarkers(frame)
# During debugging, draw or log rejected candidates.
if ids is not None:
# Process only validated detections here.
pass
# Display or otherwise consume the frame.
The exact Python return signature and detector-construction calls vary between OpenCV bindings and versions, so keep the invariant rather than copying a version-specific assignment blindly: check ok, call detection on the acquired frame, retain rejected candidates while investigating, and guard every use of ids and corners. OpenCV’s newer tutorials describe the same acquisition-detection-display flow (OpenCV Tutorials: Detection of ArUco Markers).
If the loop exits exactly when the label appears, add logging around both operations. Log whether cap.read() returned a frame, the frame dimensions, the number of detected IDs, and the number of rejected candidates. That separates a camera or transport problem from a geometry problem in a single run.
How do I prove whether the problem is geometry or thresholding?
Work from one failure frame instead of tuning several parameters at once. The following sequence makes each stage visible.
- Save the raw frame and the thresholded frame. Capture the image at the moment the label enters view. Confirm that the printed outline is actually square and that its black border is continuous. In the thresholded image, look for a border that has been opened, merged with a neighboring object, or split into several pieces.
- Log every candidate’s geometry. For each contour, record the vertex count after polygon approximation, its perimeter, area, and whether it is convex. Draw accepted and rejected candidates in different colors. A five-vertex approximation, a non-convex contour, or a very small perimeter tells you why the candidate never reaches decoding.
- Verify the dictionary and printed border. The dictionary configured in the detector must match the dictionary used to generate the marker. A visually perfect square with the wrong code family can pass geometric filtering but still fail decoding. The marker’s black border also has to be present and unobstructed.
- Move the label inward. Test with a clear margin around every side. OpenCV warns that when a marker corner is near the image border, the returned corner can be inaccurate near that border. If the candidate becomes stable after repositioning, the issue is framing or border clipping rather than the marker’s identity.
- Check corner order in your application. Consume points as top-left, top-right, bottom-right, bottom-left, in clockwise order. A detector can be correct while downstream code applies a homography, pose calculation, or overlay with a different order and makes the corners appear “wrong.”
- Only then tune detector parameters. Change one setting, repeat the saved-frame check, and keep the rejected-candidate drawings. Looser filters can admit more false candidates and increase processing cost, so a setting that produces more detections is not automatically a fix.
Which ArUco settings can create a five-corner candidate?
Three groups of parameters commonly affect the candidate that you see: adaptive-threshold windows, perimeter limits, and polygon-approximation accuracy. They influence whether the border is found, whether the candidate is large enough to consider, and how many vertices its contour receives.
Free tools Windows power users keep installed
One-click scans. No signup required.
Also popular on Amazon
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Adaptive threshold windows
ArUco typically examines multiple adaptive-threshold window sizes. If a window is poorly matched to the marker’s apparent size, one side of the black border can disappear or connect to the background. The resulting contour may have five vertices, several fragments, or no usable contour at all. A window range that is too narrow can miss markers at different distances; a range that is too broad adds work and may create noise. Tune against the actual marker scale in your frames, not against a single ideal close-up.
minMarkerPerimeterRate and maxMarkerPerimeterRate
These limits are relative to the image’s largest dimension. OpenCV’s documentation gives a concrete calculation: in a 640×480 image, minMarkerPerimeterRate = 0.05 corresponds to a minimum perimeter of 32 pixels because 0.05 is applied to the 640-pixel dimension. A marker below that limit is rejected before decoding; an excessively high minimum can make a distant but otherwise valid marker disappear. The maximum rate prevents very large contours from being treated as markers.
Use the calculation to understand scale, then choose rates that cover the smallest and largest marker you expect. Do not copy the 640×480 example unchanged when your stream has a different resolution.
polygonalApproxAccuracyRate
This value controls how much contour error is allowed during polygon approximation. For a candidate with a 100-pixel perimeter and a rate of 0.04, the documentation describes approximately 5.4 pixels of permitted approximation error. A larger value can simplify a noisy contour, but it can also erase genuine shape detail or make unrelated contours look square. A smaller value preserves more detail but may leave a distorted square with too many vertices. Treat the value as a geometry trade-off, not as a universal “sensitivity” slider.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallAfter every change, compare the candidate’s vertex count, convexity, and perimeter. If a pentagon remains a pentagon across reasonable settings, the detector is correctly reporting the physical geometry.
What should I do if the label is genuinely pentagonal?
Do not force the ArUco detector to accept it. Build a polygon-specific contour pipeline whose data model includes five vertices.
Also popular on Amazon
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
- Acquire and validate the frame as usual.
- Convert to a suitable intensity representation and apply a threshold or edge operation that preserves the label outline.
- Find contours and approximate each contour with a tolerance selected for the label’s scale.
- Keep candidates with five vertices, sufficient area, and convex geometry. Reject contours that touch the frame edge during initial calibration.
- Establish a stable vertex order. For example, select a reference vertex such as the uppermost point, then order the remaining points clockwise around the polygon centroid. Keep this convention identical in every downstream calculation.
- Normalize the shape with a perspective transform to a canonical pentagon before measuring, overlaying, or classifying it.
- Track the candidate across frames and reject sudden changes in area, perimeter, or ordering. This reduces flicker when blur creates temporary extra vertices.
This approach can identify a shape and its orientation, but it does not automatically provide ArUco’s dictionary coding or error-correction behavior. If the label must carry an ID, add a separate coding method that is designed for the pentagonal layout, or redesign the physical label as a square coded marker.
Should I replace the label with a square marker?
If you control the printed label, replacement is usually the shortest path to a stable ArUco system. Use printed ArUco marker labels generated from the same dictionary configured in the detector—for example, a marker from a DICT_6X6_250-compatible dictionary when that is the dictionary selected by your application.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problems- Keep the black outer border continuous and sharply printed.
- Provide a clear light margin around the marker so nearby graphics do not merge with its contour.
- Print the marker large enough for its perimeter to remain above your configured minimum at the farthest working distance.
- Verify the actual printed code and dictionary together; changing only the detector dictionary invalidates decoding.
- During setup, keep the marker away from the image edge and test it at the expected viewing angles and distances.
A square marker also simplifies perspective correction because the detector returns four corresponding corners in a consistent order. That stable ordering is valuable for overlays, planar transforms, and pose calculations.
Why are my marker corners wrong near the edge of the image?
A corner clipped by the sensor boundary has no complete neighborhood for contour estimation. OpenCV specifically cautions that a corner close to the image border may be returned at an incorrect location near that border. The detector can still produce four points, but one or more may be biased toward the edge.
For calibration and debugging, move the marker inward and leave visible background on all sides. If your application must operate at the edge, treat near-border detections as lower confidence: reject candidates whose corners fall within a safety margin, or reacquire them after the object moves inward. Do not compensate by accepting arbitrary five-point contours; that hides a framing limitation rather than fixing it.
ArUco or a contour pipeline: which fits this label?
The right choice depends on whether the physical geometry can be standardized. ArUco is preferable when you can use square coded markers. A contour pipeline is preferable when the label must remain pentagonal or another non-square shape.
Recommended Free Tools
Also popular on Amazon
- Portable and powerful USB-C HUB: BENFEI USB Type-C HUB, with super-soft and knot-free silicone woven design cable, meets most mobile office needs. Compact, lightweight, stylish, and powerful portable USB C Hub equipped with 1 x HDMI port, 1 x 100W charging, and 3 x USB ports. 18-month warranty, 24-hour response, to ensure you feel at ease when using our product.
- Design centered on comfort and reliability: Thanks to BENFEI's end-to-end in-house cable production capability, in-house PCBA and assembly capability, using the industry's most advanced silicone woven design and process, 20cm cable in length, no knots, super-soft, the HUB is easy to use in all scenarios: laptop, tablet, stand etc. Super-soft, 25000+ life cycles, to meet your daily carrying and office needs.
- 100W Charging: Support up to 90W USB C pass-through charging via Type-C port to keep your laptop powered. 10W is reserved for other interface operations. No data and video function on the Type-C port.
- 4K HDMI Display: The HDMI port supports media display at resolutions up to 4K 30Hz, keeping every incredible moment detailed and ultra vivid. Please note that the C port of the Host device needs to support video output.
- Transfer Files in Seconds: Transfer files and from your laptop at speeds up to 10 Gbps with USB A 3.2 port. Extra 2 USB A 2.0 ports are perfectly for your keyboards and mouse.
| Decision factor | Square ArUco marker | Arbitrary-polygon contour pipeline |
|---|---|---|
| Marker geometry | Requires a square candidate with four corners | Can explicitly accept five or more vertices |
| Corner order | Detector supplies a defined four-corner order | Your code must define and maintain the order |
| Perspective and blur | Benefits from square geometry and coded validation, but still depends on a visible border | Requires your own shape, tracking, and outlier rules |
| Identification | Dictionary-based IDs with error-correction support | Needs a separate coding or classification scheme |
| Processing cost | Standardized detector stages and candidate rejection | Custom thresholding, polygon checks, normalization, and tracking |
| Best use | Replaceable printed fiducials and repeatable camera setups | Fixed physical labels that cannot be made square |
This is a design decision, not merely a parameter decision. If the label’s shape is non-negotiable, choose the polygon pipeline early. If the shape is negotiable, a correctly printed square marker removes an entire class of ambiguity.
What production safeguards prevent the loop from failing again?
Keep capture, detection, validation, and application logic separate. A robust implementation should:
- Check that the camera opened and that each frame acquisition succeeded.
- Handle “no detections” as a normal state rather than indexing a null or empty ID array.
- Retain rejected candidates behind a debug flag so geometry can be inspected without changing production behavior.
- Validate that each accepted detection has four corners before applying a square-marker homography.
- Check corner order and reject points that are duplicated, self-crossing, or implausibly close together.
- Record frame size and detector parameters with diagnostic logs; perimeter-rate calculations depend on the largest image dimension.
- Use a short temporal confirmation rule when an ID first appears, so one blurred frame does not trigger a state change.
- Release camera resources and close display windows on every exit path, including a failed frame read.
When a failure is reported, capture the frame, parameter values, candidate statistics, and dictionary name together. That evidence tells you whether to repair lighting and thresholding, adjust scale limits, correct application corner order, or replace the label.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.What is the practical fix for a five-corner ArUco failure?
If inspection proves the printed object is pentagonal, stop tuning ArUco and switch to a pentagon-aware contour pipeline or print a square marker. If the object is square, repair the border or thresholding, keep it away from the frame edge, verify the dictionary, and tune perimeter and approximation settings only after those checks. In both cases, make the capture loop tolerate frames with no valid IDs so a detection miss cannot masquerade as a camera failure.
FAQ
Why does ids become empty even though I can see the label?
Visibility is not enough for decoding. The candidate may fail square-geometry filtering, fall outside the configured perimeter range, have a broken thresholded border, or use a dictionary different from the detector’s dictionary. Inspect the rejected candidates and the thresholded frame before changing application code.
Can a pentagonal label still carry an ArUco ID?
Not through the standard square-marker path. ArUco’s candidate model and four-corner ordering assume a square; a pentagonal outline needs a separate detector and an ID scheme designed for that geometry, or a replacement square marker carrying the desired code.
Also popular on Amazon
- 【Read before You Buy】 Note: This adapter is USB 2.0 version and cannot transmit HDM, VGA, or other video signals. Nevertheless, they are fully capable of charging devices,duplicating files, and can be seamlessly integrated with USB-C earphones, wireless network adapters, and SD card adapters.
- 【Easy to Use and Safe】Thanks to modern manufacturing techniques, we've made these adapters sufficiently compact so that they can remain inserted in your device without noticeable protrusion or inconvenience. This means you don't have to constantly plug and unplug them, reducing the likelihood of wear and misalignment, and making them more convenient to carry around.
- 【Reliable Quality】Engineered for enhanced durability, durable aluminum alloy shell material,get excellent wear resistance and heat dissipation,the male USB C and female USB connectors & the male USB and female USB C connectors are designed to be plugged and unplugged up to 20000 times. Provides data transfer, device charging, memory space expansion, and additional computer peripherals.
- 【Think more for you】Do you need to connect a USB-C-enabled device to an odd device that only has USB-A ports? Then these USB-A male to USB-C female adapters are made for you.Simply insert the adapter into the USB-A port on the device, and you can instantly connect your USB-C device to the device that originally didn't have the correct connection port.
- 【Trusted xiwxi Quality and Service】As a responsible brand seller, you will receive xiwxi's 12-month Quality assurance and lifetime friendly customer service, you're not just buying a product,you're investing in peace of mind with all-round quality and exceptional customer service.
What does the rejected-candidate list tell me?
It shows contours that reached candidate processing but failed later geometric or decoding checks, depending on the binding and detector stage. Drawing those contours and logging vertex count, perimeter, and convexity can reveal whether the failure is a five-sided approximation, a size limit, or a malformed border.
Are OpenCV 4 and OpenCV 5 detection calls interchangeable?
The conceptual flow is the same, but Python return values and detector-construction APIs can differ by binding and version. Check the documentation for the version installed in your environment, and write the loop around the stable behaviors: validate the frame, run detection, guard empty results, and preserve rejected candidates while debugging.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →How can I tell whether the camera or detector caused the loop to stop?
Log the boolean result from frame acquisition immediately before detection. A failed acquisition means the camera path needs attention; a successful acquisition followed by empty IDs or an exception in your processing code points to detection or missing-result handling. Saving the same frame lets you reproduce the detector side without relying on a live camera.
Frequently Asked Questions
Why does ids become empty even though I can see the label?
Visibility is not enough for decoding. The candidate may fail square-geometry filtering, fall outside the configured perimeter range, have a broken thresholded border, or use a dictionary different from the detector’s dictionary. Inspect the rejected candidates and the thresholded frame before changing application code.
Can a pentagonal label still carry an ArUco ID?
Not through the standard square-marker path. ArUco’s candidate model and four-corner ordering assume a square; a pentagonal outline needs a separate detector and an ID scheme designed for that geometry, or a replacement square marker carrying the desired code.
What does the rejected-candidate list tell me?
It shows contours that reached candidate processing but failed later geometric or decoding checks, depending on the binding and detector stage. Drawing those contours and logging vertex count, perimeter, and convexity can reveal whether the failure is a five-sided approximation, a size limit, or a malformed border.
Are OpenCV 4 and OpenCV 5 detection calls interchangeable?
The conceptual flow is the same, but Python return values and detector-construction APIs can differ by binding and version. Check the documentation for the version installed in your environment, and write the loop around the stable behaviors: validate the frame, run detection, guard empty results, and preserve rejected candidates while debugging.
How can I tell whether the camera or detector caused the loop to stop?
Log the boolean result from frame acquisition immediately before detection. A failed acquisition means the camera path needs attention; a successful acquisition followed by empty IDs or an exception in your processing code points to detection or missing-result handling. Saving the same frame lets you reproduce the detector side without relying on a live camera.

