1. 程式人生 > 其它 >OpenCV除錯圖片視覺化工具

OpenCV除錯圖片視覺化工具

技術標籤:OpenCVopencv視覺化

OpenCV除錯圖片視覺化工具

工具一 visual-logging

參考

OPENCV視覺化工具

安裝

pip install visual-logging

使用

# import 庫
from logging import FileHandler
from vlogging import VisualRecord
import logging
import webbrowser
# 初始化記錄器
Imglogger = logging.
getLogger("marker_logging") export_loggingFile = "export_logging.html" # 會在當前目錄建立一個Html檔案 # if os.path.exists(export_loggingFile)is not None: # os.remove(export_loggingFile) logfilehandler = FileHandler(export_loggingFile, mode="w") Imglogger.setLevel(logging.DEBUG)
Imglogger.addHandler(logfilehandler) # 使用記錄器記錄圖片 Img = cv2.imread('xxx.png', 0) Imglogger.debug(VisualRecord("src", [Img], fmt="png"))

在這裡插入圖片描述

工具二 opencv-log

參考

安裝

pip install opencv-log

使用

例子:

import cvlog as log
# Set default mode and level
# If we dont set, then default mode is NONE
# and the default level is ERROR
log.set_mode(log.Mode.LOG)
log.set_level(log.Level.TRACE)
img = cv2.imread("sample.png")
# log or show the image or do nothing based on log mode and log level
log.image(log.Level.INFO, img)
# If mode is None, it remain as sleeper cell
# If mode is LOG, it logs image to html file.
# If mode is DEBUG, it shows image in pop window and wait for the key.