我有这样的黑白图像(颜色覆盖是我的,可以删除):
我需要弄清楚所示手的边缘,我该怎么做?
我目前的算法:
List<Point> edgePoints = new List<Point>();
for (int x = 0; x < largest.Rectangle.Width && edgePoints.Count == 0; x++) {
//top
for (int y = 0; y < largest.Rectangle.Height - 3 && edgePoints.Count == 0; y++) {
if (colorGrid[x, y].ToArgb() == Color.White.ToArgb() &&
colorGrid[x, y + 1].ToArgb() == Color.White.ToArgb() &&
colorGrid[x, y + 2].ToArgb() == Color.White.ToArgb() &&
colorGrid[x, y + 3].ToArgb() == Color.White.ToArgb()
) {
edgePoints.Add(new Point(x, y));
//g.DrawLine(new System.Drawing.Pen(Color.Orange), new Point(largest.Rectangle.X + x, largest.Rectangle.Y + y), new …Run Code Online (Sandbox Code Playgroud) 我有一张包含血涂片的照片.我想要做的是检测那些细胞的边缘.

我首先将此彩色图像转换为灰度图像,然后填充这些单元格中的孔.我在matlab中使用edge()函数来检测边缘.由于您可以观察到某些细胞的内部部分更轻,因此在一个细胞内检测到边缘.结果如下所示:
那么是否有任何方法只能检测到这些细胞的外边缘?
我的代码如下所示:
I = imread('film02_pattern.jpg');
t1=graythresh(I);
k1=im2bw(I,t1);
k1=~k1;
se = strel('disk',1);
k1=imfill(k1,'holes');
imshow(k1);
k1=~k1;
bw = edge(k1,'canny',[],sqrt(2));
figure,imshow(bw);
Run Code Online (Sandbox Code Playgroud) 我试图从一个看起来非常清晰的图像中检测圆形。我确实意识到圆的一部分丢失了,但从我读到的关于霍夫变换的内容来看,这似乎不会导致我遇到的问题。
输入:

输出:

代码:
// Read the image
Mat src = Highgui.imread("input.png");
// Convert it to gray
Mat src_gray = new Mat();
Imgproc.cvtColor(src, src_gray, Imgproc.COLOR_BGR2GRAY);
// Reduce the noise so we avoid false circle detection
//Imgproc.GaussianBlur( src_gray, src_gray, new Size(9, 9), 2, 2 );
Mat circles = new Mat();
/// Apply the Hough Transform to find the circles
Imgproc.HoughCircles(src_gray, circles, Imgproc.CV_HOUGH_GRADIENT, 1, 1, 160, 25, 0, 0);
// Draw the circles detected
for( int i = 0; i < circles.cols(); …Run Code Online (Sandbox Code Playgroud) 我有一个噪音图像,如波纹图.假设它是高斯噪声.目前,我正在使用两个步骤来查找边缘
根据等式找到边缘
g = 1 /(1 +β∇(I*G)^ 2)
其中G是高斯滤波器.β是控制噪音水平的重量.
然而,高斯滤波器是图像边缘丢失的原因.我想找到一个更好的方法来保存边缘信息.您能否向我建议找到该图像边缘的最佳方法?
这是我上述步骤的结果
这是我正在处理的噪声添加的图像:
为了获得优势,这是我写的MATLAB代码:
beta=0.01;
G = fspecial('gaussian',[3 3],1);
I_G = conv2(I,G,'same');
[Gx,Gy] = gradient(I_G);
NormGrad = sqrt(Gx.^2 + Gy.^2);
g = 1./ (1 + beta* NormGrad.^2);
imshow(g,[]);
Run Code Online (Sandbox Code Playgroud) 为什么不能在内核大小大于 7 的 OpenCV 中执行 Canny 边缘检测?
例如,
// This works
cv::Canny(src_image, out_edges, th1, 2 * th1, 3);
cv::Canny(src_image, out_edges, th1, 2 * th1, 7);
// This raises an exception
cv::Canny(src_image, out_edges, th1, 2 * th1, 9);
Run Code Online (Sandbox Code Playgroud)
我知道 Sobel 只采用 1、3、5 或 7 的内核大小。但我见过使用内核大小为 9 的论文。这在 OpenCV 中是不可能的吗?
* 编辑 *
我一直在编辑 Canny 代码以支持更大的内核。问题出在这里(canny.cpp):
if (L2gradient)
{
low_thresh = std::min(32767.0, low_thresh);
high_thresh = std::min(32767.0, high_thresh);
if (low_thresh > 0) low_thresh *= low_thresh;
if (high_thresh > 0) high_thresh *= high_thresh;
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 WebGL 中显示纹理的清晰轮廓。我将纹理传递给片段着色器,然后使用局部导数来显示轮廓/轮廓,但是,它并不像我期望的那样平滑。
仅打印纹理而不进行处理即可按预期工作:
vec2 texc = vec2(((vProjectedCoords.x / vProjectedCoords.w) + 1.0 ) / 2.0,
((vProjectedCoords.y / vProjectedCoords.w) + 1.0 ) / 2.0 );
vec4 color = texture2D(uTextureFilled, texc);
gl_FragColor = color;
Run Code Online (Sandbox Code Playgroud)
对于本地导数,它错过了一些优势:
vec2 texc = vec2(((vProjectedCoords.x / vProjectedCoords.w) + 1.0 ) / 2.0,
((vProjectedCoords.y / vProjectedCoords.w) + 1.0 ) / 2.0 );
vec4 color = texture2D(uTextureFilled, texc);
float maxColor = length(color.rgb);
gl_FragColor.r = abs(dFdx(maxColor));
gl_FragColor.g = abs(dFdy(maxColor));
gl_FragColor.a = 1.;
Run Code Online (Sandbox Code Playgroud)
我正在构建一个网络应用程序来帮助学生学习数学.
该应用程序需要显示来自LaTex文件的数学内容.这些Latex文件渲染(精美)为pdf,我可以通过pdf2svg将其干净地转换为svg.
(svg或png或任何图像格式)图像看起来像这样:
_______________________________________
| |
| 1. Word1 word2 word3 word4 |
| a. Word5 word6 word7 |
| |
| ///////////Graph1/////////// |
| |
| b. Word8 word9 word10 |
| |
| 2. Word11 word12 word13 word14 |
| |
|_______________________________________|
Run Code Online (Sandbox Code Playgroud)
真实的例子:

Web应用程序的目的是操作并向其添加内容,从而产生如下内容:
_______________________________________
| |
| 1. Word1 word2 | <-- New line break
|_______________________________________|
| |
| -> NewContent1 |
|_______________________________________|
| |
| word3 word4 |
|_______________________________________|
| |
| -> NewContent2 |
|_______________________________________| …Run Code Online (Sandbox Code Playgroud) 我在 Python 中使用 openCV 来找到一张纸的角点以使其变形。
img = cv2.imread(images[i])
corners = cv2.goodFeaturesToTrack(cv2.cvtColor(img,cv2.COLOR_BGR2GRAY),4,.01,1000,useHarrisDetector=True,k=.04)
corners = np.float32(corners)
print(corners)
ratio = 1.6
cardH = math.sqrt((corners[2][0][0] - corners[1][0][0]) * (corners[2][0][0] - corners[1][0][0]) + (corners[2][0][1] - corners[1][0][1]) * (
corners[2][0][1] - corners[1][0][1]))
cardW = ratio * cardH;
pts2 = np.float32(
[[corners[0][0][0], corners[0][0][1]], [corners[0][0][0] + cardW, corners[0][0][1]], [corners[0][0][0] + cardW, corners[0][0][1] + cardH],
[corners[0][0][0], corners[0][0][1] + cardH]])
M = cv2.getPerspectiveTransform(corners, pts2)
offsetSize = 500
transformed = np.zeros((int(cardW + offsetSize), int(cardH + offsetSize)), dtype=np.uint8);
dst = cv2.warpPerspective(img, M, …Run Code Online (Sandbox Code Playgroud) opencv computer-vision edge-detection python-3.x corner-detection
我试图在OpenCV中对图像执行过零边缘检测.我模糊并使用cvLaplace()然后从(0,max)缩放它.我的问题是:如何以正确识别负值的方式访问该图像中的像素值?使用OpenCV(cvPtr2D)提供的函数返回无符号字符.有什么想法或意见吗?
谢谢
edge-detection ×10
opencv ×6
c++ ×2
image ×2
matlab ×2
c ×1
c# ×1
contour ×1
gaussian ×1
java ×1
outline ×1
python-3.x ×1
webgl ×1
whitespace ×1