婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識(shí)庫 > opencv實(shí)現(xiàn)回形遍歷像素算法

opencv實(shí)現(xiàn)回形遍歷像素算法

熱門標(biāo)簽:北京外呼電銷機(jī)器人招商 crm電銷機(jī)器人 南京crm外呼系統(tǒng)排名 電銷機(jī)器人 金倫通信 賓館能在百度地圖標(biāo)注嗎 汕頭電商外呼系統(tǒng)供應(yīng)商 云南地圖標(biāo)注 400電話 申請(qǐng) 條件 鄭州智能外呼系統(tǒng)中心

本文實(shí)例為大家分享了opencv實(shí)現(xiàn)回形遍歷像素算法的具體代碼,供大家參考,具體內(nèi)容如下

代碼實(shí)現(xiàn)

# -*- coding:utf-8 -*-
import cv2
import numpy as np
 
cv2.namedWindow('img', 0)
 
 
def traversePixelByCycloidLine(image):
 """
 從一副灰度圖像的中心開始向邊緣按回形線的方式遍歷所有像素,每個(gè)像素只能訪問一次。
 我目前實(shí)現(xiàn)了基本的算法, 但存在以下問題:
 1) 只支持方陣, 且行列為奇數(shù)
 2) 只實(shí)現(xiàn), 代碼沒整理
 """
 
 h, w = image.shape[:2]
 
 assert h == w and h % 2 == 1, '只支持方陣, 且行列為奇數(shù)'
 
 center_x, center_y = [w // 2, h // 2]
 
 traverse_num = h * w
 
 cycloid_num = 0
 value = 1
 while True:
 
  for i in range(cycloid_num * 2 + 1):
   if value >= traverse_num:
    return image
   center_x = center_x + 1
   image[center_y, center_x] = 255
   value += 1
   cv2.imshow('img', image)
   cv2.waitKey(33)
 
  for i in range(cycloid_num * 2 + 1):
   if value >= traverse_num:
    return image
   center_y = center_y + 1
   image[center_y, center_x] = 255
   value += 1
   cv2.imshow('img', image)
   cv2.waitKey(33)
 
  for i in range(cycloid_num * 2 + 2):
   if value >= traverse_num:
    return image
   center_x = center_x - 1
   image[center_y, center_x] = 255
   value += 1
   cv2.imshow('img', image)
   cv2.waitKey(33)
 
  for i in range(cycloid_num * 2 + 2):
   if value >= traverse_num:
    return image
   center_y = center_y - 1
   image[center_y, center_x] = 255
   value += 1
   cv2.imshow('img', image)
   cv2.waitKey(33)
  cycloid_num += 1
 
 
image_wh = 11
 
while True:
 image = np.zeros((image_wh, image_wh, 3), dtype=np.uint8)
 traversePixelByCycloidLine(image)

效果展示

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

您可能感興趣的文章:
  • python3實(shí)現(xiàn)二叉樹的遍歷與遞歸算法解析(小結(jié))
  • Python數(shù)據(jù)結(jié)構(gòu)與算法之二叉樹結(jié)構(gòu)定義與遍歷方法詳解
  • Python二叉樹的定義及常用遍歷算法分析
  • Python算法之圖的遍歷
  • python實(shí)現(xiàn)的二叉樹定義與遍歷算法實(shí)例

標(biāo)簽:懷化 昆明 西寧 文山 浙江 梅州 錫林郭勒盟 石家莊

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《opencv實(shí)現(xiàn)回形遍歷像素算法》,本文關(guān)鍵詞  opencv,實(shí)現(xiàn),回形,遍歷,像素,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《opencv實(shí)現(xiàn)回形遍歷像素算法》相關(guān)的同類信息!
  • 本頁收集關(guān)于opencv實(shí)現(xiàn)回形遍歷像素算法的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 聊城市| 庄浪县| 沅陵县| 枣阳市| 杭锦后旗| 普洱| 宁强县| 五寨县| 黎川县| 六枝特区| 安义县| 盖州市| 伊春市| 丰镇市| 古浪县| 江达县| 天门市| 彰化市| 新丰县| 图木舒克市| 准格尔旗| 南城县| 云龙县| 砚山县| 宽甸| 怀仁县| 交口县| 措美县| 隆子县| 梁平县| 玉环县| 巴彦淖尔市| 监利县| 临汾市| 墨玉县| 汤原县| 甘肃省| 孙吴县| 南阳市| 合江县| 左云县|