我在树莓派 3b 上使用 opencv 4.5.0-pre 和 python 3.7.3。我正在尝试使用 SIFT 为图像拼接找到最匹配的功能。我使用本指南从源代码构建了 opencv https://www.pyimagesearch.com/2019/09/16/install-opencv-4-on-raspberry-pi-4-and-raspbian-buster/。
import cv2
img1 = cv2.imread('image1.jpg')
gray1 = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)
img2 = cv2.imread('image2.jpg')
gray2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
sift = cv2.SIFT()
kp1, des1 = sift.detectAndCompute(gray1, None)
kp2, des2 = sift.detectAndCompute(gray2, None)
Run Code Online (Sandbox Code Playgroud)
在运行脚本时会引发此错误:
/bin/bash: line 1: 1101 Segmentation fault python3 stitch_imgs.py
shell returned 139
Press ENTER or type command to continue
Run Code Online (Sandbox Code Playgroud)
我已经尝试按照@Ahx 的建议使用 cv2.xfeatures2d.SIFT_create()。但这对我也不起作用。我得到以下输出:
[ WARN:0 ] global /home/pi/opencv_contrib/modules/xfeatures2d/misc/python/shadow_shift.hpp
(15) SIFT_create DEPRECATED: cv.xfeatures2d.SIFT_create() is deprecated due to
the main repository. …Run Code Online (Sandbox Code Playgroud) 所以我只使用了几天的 clojurescript 和试剂,我正在尝试创建一个简单的个人网站。我使用 shadow-clj 设置项目以进行热重载。
首先,我导入了所需的 material-ui 东西:
(:require [reagent-material-ui.icons.home :refer [home]]
[reagent-material-ui.icons.apps :refer [apps]]
[reagent-material-ui.core.list :refer [list]]
[reagent-material-ui.core.list-item :refer [list-item]]
[reagent-material-ui.core.list-item-icon :refer [list-item-icon]]
[reagent-material-ui.core-list-item-text :refer [list-item-text]])
Run Code Online (Sandbox Code Playgroud)
然后我在导航栏中定义了我想要的项目:
(def menu-items '({:list-icon [home] :list-text "Home"}
{:list-icon [apps] :list-text "Portfolio"}))
Run Code Online (Sandbox Code Playgroud)
然后我尝试遍历menu-items并将它们放入试剂组件中:
(defn navbar []
[list
(map (fn [item]
[list-item
[list-item-icon (:list-icon item)]
[list-item-text (:list-text item)]])
menu-items)])
Run Code Online (Sandbox Code Playgroud)
现在,当我重新加载代码时,只显示文本:list-text但没有图标。我已经尝试在没有任何循环的情况下显示图标,并且效果很好。
控制台没有错误输出只有两个警告:
Warning: Every element in a seq should have a unique :key: ([#object[reagent.impl.template.NativeWrapper] [#object[reagent.impl.template.NativeWrapper] [home]] [#object[reagent.impl.template.NativeWrapper] "Home"]] [#object[reagent.impl.template.NativeWrapper] [#object[reagent.impl.template.NativeWrapper] [apps]] [#object[reagent.impl.template.NativeWrapper] …Run Code Online (Sandbox Code Playgroud)