国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
Python and OpenCV efficiently extract two circular areas in 9000x7000 pixel images
Home Backend Development Python Tutorial How to extract two circular areas from a 9000x7000 pixel image using Python and OpenCV?

How to extract two circular areas from a 9000x7000 pixel image using Python and OpenCV?

Apr 01, 2025 pm 09:42 PM
python windows ai red

How to extract two circular areas from a 9000x7000 pixel image using Python and OpenCV?

Python and OpenCV efficiently extract two circular areas in 9000x7000 pixel images

Processing ultra-high resolution images (such as 9000x7000 pixels) and extracting specific shapes (such as circles) from them is a common challenge in image processing and computer vision. This article provides a solution using Python and OpenCV libraries to efficiently and accurately extract target circular areas.

The problem with the existing code is that there are too many circles detected and it is impossible to accurately select the two circle areas required. For improvement, we will adopt the following strategies:

  1. Image Preprocessing: Scaling and Noise Reduction : First, to improve processing efficiency, we reduce the original image to the right size. At the same time, a Gaussian blur filter is applied to reduce image noise, thereby improving the accuracy of circular detection.
 import cv2
import numpy as np

image_path = r"c:\users\17607\desktop\smls pictures\pic_20231122151507973.bmp"

# Read image img = cv2.imread(image_path)

# Zoom the image (adjust the zoom ratio according to the actual situation)
scale_percent = 10 # Scale to 1/10 of the original image
width = int(img.shape[1] / scale_percent)
height = int(img.shape[0] / scale_percent)
dim = (width, height)
resized_img = cv2.resize(img, dim, interpolation=cv2.INTER_AREA)

# grayscale conversion gray = cv2.cvtColor(resized_img, cv2.COLOR_BGR2GRAY)

# GaussianBlurred = cv2.GaussianBlur(gray, (5, 5), 0)
  1. Edge detection: Canny algorithm : Use the Canny edge detection algorithm to extract image edge information and prepare for subsequent circular detection.
 # Canny edge detection edges = cv2.Canny(blurred, 50, 150)
  1. Circle detection: Hough Transform : Use Hough Circle transformation to detect circles in images. The key is parameter adjustments to ensure that only the two circles we need are detected. Here we filter according to the radius of the circle and select the two largest circles.
 # HoughCircle Transform Circles = cv2.HoughCircles(edges, cv2.HOUGH_GRADIENT, 1, 40, param1=50, param2=30, minRadius=0, maxRadius=0)

If circles is not None:
    circles = np.uint16(np.around(circles))
    # Select two largest circles = circles[0, :]
    circles = circles[np.argsort(circles[:, 2])[::-1][:2]] # Select two circles with the largest radius for i in circles:
        center_x, center_y, radius = i
        # Draw circle cv2.circle(resized_img, (center_x, center_y), radius, (0, 0, 255), 2)
        cv2.circle(resized_img, (center_x, center_y), 2, (255, 0, 0), 3)

    cv2.imshow("Detected Circles", resized_img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

Through the above steps, we can effectively extract the two largest circular regions from high-resolution images and verify them by visualization results. It should be noted that the parameters of scale_percent and Hough transformation need to be adjusted according to the actual image to achieve the best detection effect. If two circles are of similar size, a more refined choice may be required based on the center coordinates or other features.

The above is the detailed content of How to extract two circular areas from a 9000x7000 pixel image using Python and OpenCV?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The flow of funds on the chain is exposed: What new tokens are being bet on by Clever Money? The flow of funds on the chain is exposed: What new tokens are being bet on by Clever Money? Jul 16, 2025 am 10:15 AM

Ordinary investors can discover potential tokens by tracking "smart money", which are high-profit addresses, and paying attention to their trends can provide leading indicators. 1. Use tools such as Nansen and Arkham Intelligence to analyze the data on the chain to view the buying and holdings of smart money; 2. Use Dune Analytics to obtain community-created dashboards to monitor the flow of funds; 3. Follow platforms such as Lookonchain to obtain real-time intelligence. Recently, Cangming Money is planning to re-polize LRT track, DePIN project, modular ecosystem and RWA protocol. For example, a certain LRT protocol has obtained a large amount of early deposits, a certain DePIN project has been accumulated continuously, a certain game public chain has been supported by the industry treasury, and a certain RWA protocol has attracted institutions to enter.

Bitcoin, Chainlink, and RWA resonance rise: crypto market enters institutional logic? Bitcoin, Chainlink, and RWA resonance rise: crypto market enters institutional logic? Jul 16, 2025 am 10:03 AM

The coordinated rise of Bitcoin, Chainlink and RWA marks the shift toward institutional narrative dominance in the crypto market. Bitcoin, as a macro hedging asset allocated by institutions, provides a stable foundation for the market; Chainlink has become a key bridge connecting the reality and the digital world through oracle and cross-chain technology; RWA provides a compliance path for traditional capital entry. The three jointly built a complete logical closed loop of institutional entry: 1) allocate BTC to stabilize the balance sheet; 2) expand on-chain asset management through RWA; 3) rely on Chainlink to build underlying infrastructure, indicating that the market has entered a new stage driven by real demand.

Pre-sales of Filecoin, Render, and AI storage are heating up: Is the explosion point of Web3 infrastructure coming? Pre-sales of Filecoin, Render, and AI storage are heating up: Is the explosion point of Web3 infrastructure coming? Jul 16, 2025 am 09:51 AM

Yes, Web3 infrastructure is exploding expectations as demand for AI heats up. Filecoin integrates computing power through the "Compute over Data" plan to support AI data processing and training; Render Network provides distributed GPU computing power to serve AIGC graph rendering; Arweave supports AI model weights and data traceability with permanent storage characteristics; the three are combining technology upgrades and ecological capital promotion, and are moving from the edge to the underlying core of AI.

Crypto market value exceeds US$3 trillion: Which sectors are funds betting on? Crypto market value exceeds US$3 trillion: Which sectors are funds betting on? Jul 16, 2025 am 09:45 AM

Crypto market value exceeded US$3 trillion, and funds mainly bet on seven major sectors. 1. Artificial Intelligence (AI) Blockchain: Popular currencies include FET, RNDR, AGIX, Binance and OKX launch related trading pairs and activities, funds bet on AI and decentralized computing power and data integration; 2. Layer2 and modular blockchain: ARB, OP, ZK series, TIA are attracting attention, HTX launches modular assets and provides commission rebates, funds are optimistic about their support for DeFi and GameFi; 3. RWA (real world assets): ONDO, POLYX, XDC and other related assets, OKX adds an RWA zone, and funds are expected to migrate on traditional financial chains; 4. Public chain and platform coins: SOL, BNB, HT, OKB are strong

Changes in the flow of on-chain funds: What tracks are new funds pouring into? Changes in the flow of on-chain funds: What tracks are new funds pouring into? Jul 16, 2025 am 09:42 AM

The most popular tracks for new funds currently include re-staking ecosystems, integration of AI and Crypto, revival of the Bitcoin ecosystem and DePIN. 1) The re-staking protocol represented by EigenLayer improves capital efficiency and absorbs a large amount of long-term capital; 2) The combination of AI and blockchain has spawned decentralized computing power and data projects such as Render, Akash, Fetch.ai, etc.; 3) The Bitcoin ecosystem expands application scenarios through Ordinals, BRC-20 and Runes protocols to activate silent funds; 4) DePIN builds a realistic infrastructure through token incentives to attract the attention of industrial capital.

Dogecoin, Pepe, Brett swept the meme track: speculation or new narrative? Dogecoin, Pepe, Brett swept the meme track: speculation or new narrative? Jul 16, 2025 am 09:57 AM

Dogecoin, Pepe and Brett are leading the meme coin craze. Dogecoin (DOGE) is the originator, firmly ranked first in the market value list, Pepe (PEPE) has achieved hundreds of times increase with its social geek culture, and Brett (BRETT) has become popular with its unique visual style as a new star in Base chain; the three were issued in 2013, 2023 and 2024 respectively. Technically, Dogecoin is based on Litecoin, Pepe and Brett are ERC-20 tokens, and the latter relies on the Base chain to improve efficiency. In terms of community, DOGE Twitter fans have exceeded 3 million, Pepe Reddit is leading in activity, Brett's popularity in Base chain, and DOGE has logged in on the platform.

Altcoins rebound across the board: A new bull market has started? Is it worth entering? Altcoins rebound across the board: A new bull market has started? Is it worth entering? Jul 16, 2025 am 09:48 AM

Yes, the altcoin rebound may indicate that a new bull market has begun, but entry should be cautious. 1. Market sentiment has recovered, and the trading volume of altcoins on platforms such as Binance, Ouyi, and Huobi has surged, and funds have flowed into the AI, Layer2, and GameFi sectors; 2. The counterfeit rebound shows the characteristics of the early bull market, Bitcoin has stabilized, hot spot rotation has accelerated, and new projects have frequently been launched; 3. Whether to enter the market needs to be judged based on investment strategy: long-term investors can gradually build positions in leading projects, short-term traders can pay attention to opportunities in active currency bands, and try new coins in small positions to avoid chasing highs; 4. In the future, we need to observe whether Bitcoin can break through the previous high, the flow of funds on the three major platforms, the Fed's policies and on-chain activity and other key indicators to judge the sustainability of the market.

The most promising altcoins in the 2025 currency circle (with platform address included) The most promising altcoins in the 2025 currency circle (with platform address included) Jul 16, 2025 am 09:21 AM

Altcoins worth paying attention to in 2025 include Solana (SOL), Chainlink (LINK), Near Protocol (NEAR) and Arbitrum (ARB), which have advantages in transaction speed, cross-chain infrastructure, user-friendliness and the Layer 2 ecosystem, and can be obtained on mainstream platforms. 1. Solana has become the first choice for high-frequency applications with high TPS and low fees. Firedancer will enhance its performance when it launches; 2. Chainlink, as a key oracle project, plays an important role in RWA and cross-chain interoperability; 3. Near lowers the Web3 threshold through human readable accounts and AI strategies to promote

See all articles