随笔分类 -  Python

上一页 1 2 3 4 5 6 7 8 9 ··· 15 下一页
Python zone
摘要:# coding: utf-8 # 打开摄像头并灰度化显示 import cv2 as cv camera_id = "rtsp://admin:1222@192.168.0.218:554/jingli/realmonitor?channel=1&subtype=0" # 0表示摄像头的编号 ca 阅读全文
posted @ 2023-06-14 19:46 西北逍遥 阅读(64) 评论(0) 推荐(0)
摘要:CJJC项目实验环境配置 (base) D:\> (base) D:\>conda create -n wind_2022 python==3.7 Solving environment: done ## Package Plan ## environment location: D:\Anacon 阅读全文
posted @ 2023-06-12 18:41 西北逍遥 阅读(99) 评论(0) 推荐(0)
摘要:python opencv addWeighted import cv2 # Load the image img = cv2.imread('20230222100736979.jpg') # Adjust the brightness brightness = 50 adjusted = cv2 阅读全文
posted @ 2023-06-08 19:47 西北逍遥 阅读(24) 评论(0) 推荐(0)
摘要:python opencv图片旋转任意角度 import cv2 # Load the image img = cv2.imread("20230222100736979.jpg") # Get the image dimensions height, width = img.shape[:2] # 阅读全文
posted @ 2023-06-07 19:50 西北逍遥 阅读(258) 评论(0) 推荐(0)
摘要:python opencv GaussianBlur import cv2 # Load the image img = cv2.imread('20230222100736979.jpg') # Apply a Gaussian blur with a kernel size of 5x5 blu 阅读全文
posted @ 2023-06-06 20:18 西北逍遥 阅读(106) 评论(0) 推荐(0)
摘要:import cv2 mask = cv2.imread(r"2.png", 0) mask[mask > 100] = 255 mask[mask != 255] = 0 cnts, _ = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPRO 阅读全文
posted @ 2023-06-02 19:17 西北逍遥 阅读(430) 评论(0) 推荐(0)
摘要:python通过文件操作字典 python把字典保存到文件中 python从文件中加载字典 import json my_dict = { 'Apple': 4, 'Banana': 2, 'Orange': 6, 'Grapes': 11,'area1':[[23,56],[66,12],[68, 阅读全文
posted @ 2023-06-01 12:34 西北逍遥 阅读(54) 评论(0) 推荐(0)
摘要:import pyrealsense2.pyrealsense2 as rs import configparser import numpy as np import time import csv import cv2 config_pro = configparser.ConfigParser 阅读全文
posted @ 2023-05-29 16:18 西北逍遥 阅读(832) 评论(1) 推荐(0)
摘要:def plot_results_overlay(start=0, stop=0): # from utils.plots import *; plot_results_overlay() # Plot training 'results*.txt', overlaying train and va 阅读全文
posted @ 2023-05-28 19:55 西北逍遥 阅读(73) 评论(0) 推荐(0)
摘要:import cv2 import numpy as np # 加载图像 img = cv2.imread('image.jpg', 0) # 对图像进行分水岭算法的梯度变换 gx = cv2.Sobel(img, cv2.CV_32F, 1, 0, ksize=3) gy = cv2.Sobel( 阅读全文
posted @ 2023-05-25 20:55 西北逍遥 阅读(23) 评论(0) 推荐(0)
摘要:python np.array截取 import numpy as np list1 = np.array([[1,1,1,222],[4,4,4,6],[2,2,2,555],[6,6,6,888],[9,9,9,111]]) list2 = list1[2:,] print(list1) pri 阅读全文
posted @ 2023-05-19 08:25 西北逍遥 阅读(104) 评论(0) 推荐(0)
摘要:opencv模板匹配 读取图像并转换为灰度图像。 import cv2 # 读取图像 img = cv2.imread('template.jpg') # 转换为灰度图像 gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 检测关键点并绘制矩形框。 # 使用SI 阅读全文
posted @ 2023-05-17 18:25 西北逍遥 阅读(67) 评论(0) 推荐(0)
摘要:计算点到直线的距离 import numpy as np def get_distance_from_point_to_line(point, line_point1, line_point2): #对于两点坐标为同一点时,返回点与点的距离 if line_point1 == line_point2 阅读全文
posted @ 2023-05-16 22:01 西北逍遥 阅读(179) 评论(0) 推荐(0)
摘要:opencv高斯卷积 高斯卷积是计算机视觉领域中的一种基础卷积操作,用于在一维或二维空间中对图像进行卷积运算。下面是使用OpenCV库实现高斯卷积的基本步骤: 读取图像并转换为灰度图像。 import cv2 # 读取图像 img = cv2.imread('image.jpg') # 转换为灰度图 阅读全文
posted @ 2023-05-15 16:55 西北逍遥 阅读(206) 评论(0) 推荐(0)
摘要:opencv模板匹配 import cv2 # 加载标准图像 template = cv2.imread('template.jpg') # 预处理输入图像 gray = cv2.cvtColor(template, cv2.COLOR_BGR2GRAY) gray = cv2.GaussianBl 阅读全文
posted @ 2023-05-14 19:26 西北逍遥 阅读(44) 评论(0) 推荐(0)
摘要:python rgb位运算合成一个数 在pcd中,经常会把颜色通道r g b三个值合成一个值,具体方法如下: red = 255 green = 0 blue = 0 rgb_color = (red << 8 | green << 0 | blue << 24) int_color = ((((r 阅读全文
posted @ 2023-05-12 12:59 西北逍遥 阅读(117) 评论(0) 推荐(0)
摘要:使用Open3D进行PCD拟合平面的Python代码示例 import open3d as o3d import numpy as np # 读取点云数据 pcd = o3d.io.read_point_cloud("2023042501.pcd") # 创建PCD图 pcd_graph = o3d 阅读全文
posted @ 2023-05-11 20:49 西北逍遥 阅读(675) 评论(0) 推荐(0)
摘要:PyQt 中访问 HTTP 接口并传递数据,您可以使用 PyQt 的 QTcpServer 类和 QTcpSocket 类。以下是一个简单的示例代码,演示如何使用 QTcpServer 类和 QTcpSocket 类来访问 HTTP 接口并传递数据: import sys from PyQt5.Qt 阅读全文
posted @ 2023-05-08 07:29 西北逍遥 阅读(554) 评论(0) 推荐(0)
摘要:#!/usr/bin/python from __future__ import print_function import numpy as np import sys import json import ctypes import os import binascii import struc 阅读全文
posted @ 2023-05-07 07:46 西北逍遥 阅读(208) 评论(0) 推荐(0)
摘要:python三角网格划分示例 import numpy as np import turtle # 输入三角形的边长 length = float(input("Enter the length of the triangle: ")) # 计算最短边、最长边和三角形个数 short_side = 阅读全文
posted @ 2023-04-24 16:06 西北逍遥 阅读(223) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 ··· 15 下一页