简体   繁体   English

使用开放式CV python对两个图像进行边缘检测和直方图匹配。

[英]Edge detection and histogram matching of two images using open CV python.

I need to find edge detection of medical images using OpenCV python .Which edge detector will be the best suited for my work? 我需要使用OpenCV python查找医学图像的边缘检测。哪种边缘检测器最适合我的工作? I have tried using canny Edge detector. 我尝试使用Canny Edge检测器。 I want to find edges of the medical images and find the histogram matching between two images. 我想找到医学图像的边缘,并找到两个图像之间的直方图匹配。 Thanks in Advance:) 提前致谢:)

Can you post the images you're working on ? 您可以发布正在处理的图像吗? That will be better. 那会更好。

Also, you can try this code. 另外,您可以尝试此代码。 It allows you to change the parameters of canny filters, Thresold 1 and thresold 2 and hence you will get an overall idea how you can apply canny filter to the image. 它允许您更改Canny滤镜的参数Thresold 1和thresold 2,因此,您将获得一个总体思路,如何将Canny滤镜应用于图像。

import cv2
import numpy as np

def nothing(x):
    pass

#image window
cv2.namedWindow('image')

#loading images
img = cv2.imread('leo-messi-pic.jpg',0)     # load your image with proper path

# create trackbars for color change
cv2.createTrackbar('th1','image',0,255,nothing)
cv2.createTrackbar('th2','image',0,255,nothing)

while(1):
    # get current positions of four trackbars
    th1 = cv2.getTrackbarPos('th1','image')
    th2 = cv2.getTrackbarPos('th2','image')
    #apply canny 
    edges = cv2.Canny(img,th1,th2)
    #show the image
    cv2.imshow('image',edges)
    #press ESC to stop
    k = cv2.waitKey(1) & 0xFF
    if k == 27:
        break

cv2.destroyAllWindows()

As far as, histogram comparison is concerned. 就直方图比较而言。 You can find all the histogram related cv2 APIs here. 您可以在此处找到所有与直方图相关的cv2 API。

http://docs.opencv.org/modules/imgproc/doc/histograms.html http://docs.opencv.org/modules/imgproc/doc/histograms.html

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM