資源簡介
數(shù)據(jù)附件t8是一個黑白圖像,計算所有柵格到距離它最近的白色柵格的距離,使用距離數(shù)據(jù)形成新圖像。原始數(shù)據(jù)有RGB三個通道,取出一個通道即可。
【核心代碼】
計算圖像中點到最近白點距離
├── t8
│ ├── gis-mini.jpg
│ └── gis.jpg
└── 計算圖像最近柵格.py
1 directory, 3 files
代碼片段和文件信息
import?cv2
import?numpy?as?np
pic_path=‘t8\\gis.jpg‘
#第二個參數(shù):{小于1:原圖大于1灰度圖}
image?=?cv2.imread(pic_path?1)
cv2.imshow(‘image‘image)
image=image[::0]
heightwidth=image.shape
#retval?image?=?cv2.threshold(imageGray?0?255?cv2.THRESH_OTSU)
kernel?=?np.ones((33)np.uint8)
ProcessImg=np.zeros([heightwidth]?dtype=np.uint8)
ProcessImgRGB=np.zeros([heightwidth3]?dtype=np.uint8)
distance=10
while?True:
????if?np.all(image==255):
????????print(“全是0“)
????????break
????else:
????????dilation?=?cv2.dilate(image?kernel?iterations=1)
????????deltaImg=dilation-image
????????index=np.where(deltaImg>0)
????????ProcessImg[index]=distance
????????distance+=10
????????print(distance)
????????image=dilation
ProcessImgRGB[::2]=ProcessImg
cv2.imshow(‘image2‘ProcessImgRGB)
cv2.waitKey(0)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2020-06-24?11:03??計算圖像中點到最近白點距離\
?????目錄???????????0??2020-06-24?11:04??計算圖像中點到最近白點距離\t8\
?????文件???????28802??2020-06-21?00:14??計算圖像中點到最近白點距離\t8\gis-mini.jpg
?????文件???????44885??2020-06-20?17:03??計算圖像中點到最近白點距離\t8\gis.jpg
?????文件?????????876??2020-06-23?23:24??計算圖像中點到最近白點距離\計算圖像最近柵格.py
評論
共有 條評論
相關(guān)資源
- 從圖像數(shù)據(jù)集讀取圖片并拼接成大圖
- python空心電感計算器
- 基于樹莓派的動態(tài)圖像對比(py3_ob<
- python 雷達圖像識別
- unet用于圖像分割(model.py)
- 基于opencv和tkinter的圖像處理GUI-源代碼
- Python開發(fā)計算器-多功能版
- Python OpenCV 圖像輪廓-.zip
- Python OpenCV 圖像運算-.zip
- Python OpenCV 圖像處理基礎(chǔ)-.zip
- Python OpenCV 圖像平滑處理-.zip
- Python OpenCV 圖像梯度-.zip
- Python OpenCV 圖像金字塔-.zip
- 基于機器學(xué)習(xí)框架tensorflow的圖像分類
- python科學(xué)計算源代碼
- python 簡易計算器
- python 對于圖像的邊緣處理、腐蝕、面
- python攝像頭采集圖像與庫中圖像分析
- 《Python計算機視覺編程》pdf-高清 帶標
- Python科學(xué)計算最佳實踐——SciPy指南(
- 《像計算機科學(xué)家一樣思考Python》p
- python實用多功能計算器
- 《OpenCV3 計算機視覺-Python 語言實現(xiàn)(
- Python 3.4 入門指南 官方中文版.pdf
- python 實現(xiàn)圖像手繪效果
- python圖像處理(Background Matting)
- Python項目案例開發(fā)從入門到實戰(zhàn)源代
- 計算 語義分割結(jié)果 MIOU,miou.py操作簡
- python實現(xiàn)身份證號碼分割提取
- python集合計算器+集合恒等式證明器