OpenCV

文章目录

  • OpenCV学习报告
    • 读取图片和网络摄像头
      • 1.1 图片读取
      • 1.2 视频读取
        • 1.1.1 读取视频文件
        • 1.1.2读取网络摄像头
    • OpenCV基础功能
    • 调整、裁剪图像
      • 3.1 调整图像大小
      • 3.2 裁剪图像
    • 图像上绘制形状和文本
      • 4.1 图像上绘制形状
      • 4.2图像上写文字
    • 透视变换
    • 图像拼接
    • 颜色检测
    • 轮廓检测
    • 人脸检测
      • 9.1静态图片
      • 9.2 摄像头
    • 实战
      • 10.1虚拟绘画
      • 10.2纸张扫描
      • 10.3 车牌检测器
    • 参考资料

OpenCV学习报告

读取图片和网络摄像头

1.1 图片读取

import cv2
# read image
img = cv2.imread("Resources/dnn.jpg")
cv2.imshow("Output",img)
cv2.waitKey(0)

在这里插入图片描述

1.2 视频读取

1.1.1 读取视频文件

import cv2
# read video
cap = cv2.VideoCapture("Resources/test_video.mp4")
while True:success,img = cap.read()cv2.imshow("Video",img)if cv2.waitKey(1) & 0xFF == ord('q'):break

在这里插入图片描述

1.1.2读取网络摄像头

import cv2
# read webcam
cap = cv2.VideoCapture(0)
cap.set(3,640) #width
cap.set(4,480) #height
cap.set(10,100)while True:success,img = cap.read()cv2.imshow("Video",img)if cv2.waitKey(1) & 0xFF == ord('q'):break

在这里插入图片描述

OpenCV基础功能

import cv2
import numpy as np
# basic function
img = cv2.imread("Resources/dnn.jpg")
kernel = np.ones((5,5),np.uint8)# 灰度转换
imgGray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
# 图像模糊
imgBlur = cv2.GaussianBlur(imgGray,(7,7),0)
# 边缘检测
imgCanny = cv2.Canny(img,100,100)
# 膨胀
imgDialation = cv2.dilate(imgCanny, kernel,iterations=1)
# 腐蚀
imgEroded = cv2.erode(imgDialation,kernel,iterations=1)# cv2.imshow("Output",img)
cv2.imshow("Gray Image",imgGray)
cv2.imshow("Blur Image",imgBlur)
cv2.imshow("Blur Image",imgCanny)
cv2.imshow("Dialation Image",imgDialation)
cv2.imshow("Eroded Image",imgEroded)cv2.waitKey(0)

在这里插入图片描述
在这里插入图片描述

调整、裁剪图像

3.1 调整图像大小

import cv2# resize imageimg = cv2.imread("Resources/lambo.PNG")
print(img.shape)imgResize = cv2.resize(img,(300,200))
print(imgResize.shape)cv2.imshow("Image",img)
cv2.imshow("Image Resize",imgResize)cv2.waitKey(0)

在这里插入图片描述

3.2 裁剪图像

import cv2img=cv2.imread("Resources/lambo.PNG")
cv2.imshow('image',img)print(img.shape)#height,width,dpthcrop_img=img[100:400,50:500]
cv2.imshow('crop image',crop_img)cv2.waitKey(0)

在这里插入图片描述

图像上绘制形状和文本

4.1 图像上绘制形状

import cv2
import numpy as np
# shapes and texts
img = np.zeros((512,512,3),np.uint8)
cv2.imshow('oringin image',img)cv2.line(img,(0,0),(img.shape[1],img.shape[0]),(0,255,0),3)
cv2.imshow('line image',img)cv2.rectangle(img,(0,0),(250,350),(0,0,255),2)
cv2.imshow('rectangle image',img)cv2.circle(img,(400,500),30,(255,255,0),5)
cv2.imshow('circle image',img)cv2.waitKey(0)

在这里插入图片描述

4.2图像上写文字

import cv2
import numpy as npimg = np.zeros((512,512,3),np.uint8)
cv2.imshow('oringin image',img)cv2.putText(img,"OPENCV",(300,200),cv2.FONT_HERSHEY_COMPLEX,1,(0,150,0),1)
cv2.imshow("putText01 Image",img)
cv2.putText(img,"I LOVE XD",(100,300),cv2.FONT_HERSHEY_COMPLEX,1,(0,150,0),1)
cv2.imshow("putText02 Image",img)cv2.waitKey(0)

在这里插入图片描述

透视变换

import cv2
import numpy as np
# warp perspective
img = cv2.imread("Resources/cards.jpg")width,height = 250,350
pts1 = np.float32([[111,219],[287,188],[154,482],[352,440]])
pts2 = np.float32([[0,0],[width,0],[0,height],[width,height]])
matrix = cv2.getPerspectiveTransform(pts1,pts2)
imgOutput = cv2.warpPerspective(img,matrix,(width,height))cv2.imshow("Image",img)
cv2.imshow("Output",imgOutput)cv2.waitKey(0)

在这里插入图片描述

图像拼接

import cv2
import numpy as np
# join images
def stackImages(scale,imgArray):rows = len(imgArray)cols = len(imgArray[0])rowsAvailable = isinstance(imgArray[0], list)width = imgArray[0][0].shape[1]height = imgArray[0][0].shape[0]if rowsAvailable:for x in range ( 0, rows):for y in range(0, cols):if imgArray[x][y].shape[:2] == imgArray[0][0].shape [:2]:imgArray[x][y] = cv2.resize(imgArray[x][y], (0, 0), None, scale, scale)else:imgArray[x][y] = cv2.resize(imgArray[x][y], (imgArray[0][0].shape[1], imgArray[0][0].shape[0]), None, scale, scale)if len(imgArray[x][y].shape) == 2: imgArray[x][y]= cv2.cvtColor( imgArray[x][y], cv2.COLOR_GRAY2BGR)imageBlank = np.zeros((height, width, 3), np.uint8)hor = [imageBlank]*rowshor_con = [imageBlank]*rowsfor x in range(0, rows):hor[x] = np.hstack(imgArray[x])ver = np.vstack(hor)else:for x in range(0, rows):if imgArray[x].shape[:2] == imgArray[0].shape[:2]:imgArray[x] = cv2.resize(imgArray[x], (0, 0), None, scale, scale)else:imgArray[x] = cv2.resize(imgArray[x], (imgArray[0].shape[1], imgArray[0].shape[0]), None,scale, scale)if len(imgArray[x].shape) == 2: imgArray[x] = cv2.cvtColor(imgArray[x], cv2.COLOR_GRAY2BGR)hor= np.hstack(imgArray)ver = horreturn verimg = cv2.imread('Resources/dnn.jpg')
imgGray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)imgStack = stackImages(0.5,([img,imgGray,img],[img,img,img]))# imgHdr = np.hstack((img,img))
# imgVer = np.vstack((img,img))
# cv2.imshow("Horizontal",imgHdr)
# cv2.imshow("Vertical",imgVer)cv2.imshow("ImageStack",imgStack)cv2.waitKey(0)

在这里插入图片描述

颜色检测

import cv2
import numpy as np
# color dectiondef empty(a):pass
'''连接图片'''
def stackImages(scale,imgArray):rows = len(imgArray)cols = len(imgArray[0])rowsAvailable = isinstance(imgArray[0], list)width = imgArray[0][0].shape[1]height = imgArray[0][0].shape[0]if rowsAvailable:for x in range ( 0, rows):for y in range(0, cols):if imgArray[x][y].shape[:2] == imgArray[0][0].shape [:2]:imgArray[x][y] = cv2.resize(imgArray[x][y], (0, 0), None, scale, scale)else:imgArray[x][y] = cv2.resize(imgArray[x][y], (imgArray[0][0].shape[1], imgArray[0][0].shape[0]), None, scale, scale)if len(imgArray[x][y].shape) == 2: imgArray[x][y]= cv2.cvtColor( imgArray[x][y], cv2.COLOR_GRAY2BGR)imageBlank = np.zeros((height, width, 3), np.uint8)hor = [imageBlank]*rowshor_con = [imageBlank]*rowsfor x in range(0, rows):hor[x] = np.hstack(imgArray[x])ver = np.vstack(hor)else:for x in range(0, rows):if imgArray[x].shape[:2] == imgArray[0].shape[:2]:imgArray[x] = cv2.resize(imgArray[x], (0, 0), None, scale, scale)else:imgArray[x] = cv2.resize(imgArray[x], (imgArray[0].shape[1], imgArray[0].shape[0]), None,scale, scale)if len(imgArray[x].shape) == 2: imgArray[x] = cv2.cvtColor(imgArray[x], cv2.COLOR_GRAY2BGR)hor= np.hstack(imgArray)ver = horreturn ver# 调整滑动条的位置来改变图像的颜色阈值,从而实现对图像的颜色分割或过滤
path = 'Resources/lambo.PNG'
framWidth = 640
framHeight = 480cap = cv2.VideoCapture(path)
cap.set(3,framWidth) #width
cap.set(4,framHeight) #height
cap.set(10,150)cv2.namedWindow("TrackBars")
cv2.resizeWindow("TrackBars",640,240)
cv2.createTrackbar("Hue Min","TrackBars",0,179,empty)  # hue
cv2.createTrackbar("Hue Max","TrackBars",179,179,empty)
cv2.createTrackbar("Sat Min","TrackBars",0,255,empty) # saturation
cv2.createTrackbar("Sat Max","TrackBars",255,255,empty)
cv2.createTrackbar("Val Min","TrackBars",0,255,empty)  # value
cv2.createTrackbar("Val Max","TrackBars",255,255,empty)while True:img = cv2.imread(path)imgHSV = cv2.cvtColor(img,cv2.COLOR_BGR2HSV)h_min = cv2.getTrackbarPos("Hue Min","TrackBars")h_max = cv2.getTrackbarPos("Hue Max", "TrackBars")s_min = cv2.getTrackbarPos("Sat Min", "TrackBars")s_max = cv2.getTrackbarPos("Sat Max", "TrackBars")v_min = cv2.getTrackbarPos("Val Min", "TrackBars")v_max = cv2.getTrackbarPos("Val Max", "TrackBars")# print(h_min,h_max,s_min,s_max,v_min,v_max)lower = np.array([h_min,s_min,v_min])upper = np.array([h_max,s_max,v_max])#用掩码对原始图像进行位运算mask = cv2.inRange(imgHSV,lower,upper)imgResult = cv2.bitwise_and(img,img,mask=mask) #二值图像# cv2.imshow("Original",img)# cv2.imshow("HSV",imgHSV)# cv2.imshow("Mask", mask)# cv2.imshow("Result", imgResult)imgStack = stackImages(0.6, ([img, imgHSV], [mask, imgResult]))cv2.imshow("Stacked Images", imgStack)cv2.waitKey(1)

在这里插入图片描述

轮廓检测

import cv2
import numpy as np#contours / shape detectiondef stackImages(scale,imgArray):rows = len(imgArray)cols = len(imgArray[0])rowsAvailable = isinstance(imgArray[0], list)width = imgArray[0][0].shape[1]height = imgArray[0][0].shape[0]if rowsAvailable:for x in range ( 0, rows):for y in range(0, cols):if imgArray[x][y].shape[:2] == imgArray[0][0].shape [:2]:imgArray[x][y] = cv2.resize(imgArray[x][y], (0, 0), None, scale, scale)else:imgArray[x][y] = cv2.resize(imgArray[x][y], (imgArray[0][0].shape[1], imgArray[0][0].shape[0]), None, scale, scale)if len(imgArray[x][y].shape) == 2: imgArray[x][y]= cv2.cvtColor( imgArray[x][y], cv2.COLOR_GRAY2BGR)imageBlank = np.zeros((height, width, 3), np.uint8)hor = [imageBlank]*rowshor_con = [imageBlank]*rowsfor x in range(0, rows):hor[x] = np.hstack(imgArray[x])ver = np.vstack(hor)else:for x in range(0, rows):if imgArray[x].shape[:2] == imgArray[0].shape[:2]:imgArray[x] = cv2.resize(imgArray[x], (0, 0), None, scale, scale)else:imgArray[x] = cv2.resize(imgArray[x], (imgArray[0].shape[1], imgArray[0].shape[0]), None,scale, scale)if len(imgArray[x].shape) == 2: imgArray[x] = cv2.cvtColor(imgArray[x], cv2.COLOR_GRAY2BGR)hor= np.hstack(imgArray)ver = horreturn verdef getContours(img):contours,hierarchy = cv2.findContours(img,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE)for cnt in contours:area = cv2.contourArea(cnt)print(area)if area>500:cv2.drawContours(imgContour,cnt,-1,(255,0,0),3)#计算轮廓曲线长度peri = cv2.arcLength(cnt,True)print(peri)approx = cv2.approxPolyDP(cnt,0.02*peri,True)print(len(approx))objCor = len(approx)x,y,w,h = cv2.boundingRect(approx)# 图形分类if objCor == 3: objectType = "Tri"elif objCor == 4 :aspRatio = w / float(h)if aspRatio > 0.98 and aspRatio < 1.03: objectType = "Square"else: objectType = "Rectangle"elif objCor > 4: objectType = "Circles"else: objectType = "None"cv2.rectangle(imgContour,(x,y),(x+w,y+h),(0,255,0),2)cv2.putText(imgContour,objectType,(x+(w//2)-10,y+(h//2)-10),cv2.FONT_HERSHEY_COMPLEX,0.7,(0,0,0),2)path = 'Resources/shapes.png'
img = cv2.imread(path)
imgContour = img.copy()imgGray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
imgBlur = cv2.GaussianBlur(imgGray,(7,7),1)
imgCanny = cv2.Canny(imgBlur,50,50)
getContours(imgCanny)imgBlank = np.zeros_like(img)
imgStack = stackImages(0.8,([img,imgGray],[imgCanny,imgContour]))cv2.imshow("Stack",imgStack)cv2.waitKey(0)

在这里插入图片描述

人脸检测

9.1静态图片

import cv2
# face detection
faceCascade = cv2.CascadeClassifier("Resources/haarcascade_frontalface_default.xml")
img = cv2.imread("Resources/dnn.jpg")
imgGray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)faces = faceCascade.detectMultiScale(imgGray,1.1,4)for(x,y,w,h) in faces:cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
cv2.imshow("Result",img)cv2.waitKey(0)

在这里插入图片描述

9.2 摄像头

import cv2faceCascade = cv2.CascadeClassifier("Resources/haarcascade_frontalface_default.xml")cap = cv2.VideoCapture(0)
cap.set(3,640) #width
cap.set(4,480) #height
cap.set(10,100)while True:success,img = cap.read()cv2.imshow("Video",img)imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)faces = faceCascade.detectMultiScale(imgGray, 1.1, 4)for (x, y, w, h) in faces:cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2)cv2.imshow("Result", img)if cv2.waitKey(1) & 0xFF == ord('q'):break

在这里插入图片描述

实战

10.1虚拟绘画

import cv2
import numpy as npframeWidth = 640
frameHeight = 480
cap = cv2.VideoCapture(0)
cap.set(3, frameWidth)
cap.set(4, frameHeight)
cap.set(10, 150)# 想要检测的颜色
myColors = [[0,89,0,98,255,255], [0,47,0,97,255,255], [0,66,0,179,255,255], [0,54,0,98,255,255]]
# 想要绘制的颜色  BGR
myColorValues = [[51, 153, 255],[0, 255, 0],[255,0,0],[0,255,255]]
# 绘制的点的列表
myPoints = []  ## [x , y , colorId ]"""获取想要绘制的,及对应的颜色"""
def findColor(img, myColors, myColorValues):imgHSV = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)count = 0newPoints = []for color in myColors:lower = np.array(color[0:3])upper = np.array(color[3:6])mask = cv2.inRange(imgHSV, lower, upper) x, y = getContours(mask)  # 想要绘制的点cv2.circle(imgResult, (x, y), 20, myColorValues[count], cv2.FILLED)  # 将点绘制在图上if x != 0 and y != 0:newPoints.append([x, y, count])  # 将点添加到 newPoints列表中,count为想要绘制颜色的编号count += 1return newPoints  def getContours(img):contours, Heriachy = cv2.findContours(img, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) x, y, w, h = 0, 0, 0, 0for cnt in contours:area = cv2.contourArea(cnt)if area > 500:# cv2.drawContours(imgResult, cnt, -1, (255, 0, 0), 3)peri = cv2.arcLength(cnt, True)approx = cv2.approxPolyDP(cnt, 0.02 * peri, True)x, y, w, h = cv2.boundingRect(approx)  return x + w // 2, y  """把点绘制在画布上"""
def drawOnCanvas(myPoints, myColorValues):for point in myPoints:cv2.circle(imgResult, (point[0], point[1]), 20, myColorValues[point[2]], cv2.FILLED)while True:success, img = cap.read()imgResult = img.copy()newPoints = findColor(img, myColors, myColorValues)  # 想要绘制的点if len(newPoints) != 0:for newP in newPoints:myPoints.append(newP)if len(myPoints) != 0:drawOnCanvas(myPoints, myColorValues)  # 将点绘制在画布上cv2.imshow("Result", imgResult)if cv2.waitKey(1) & 0xFF == ord('q'):break

利用颜色检测滑杆来得出笔的颜色

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

10.2纸张扫描

import cv2
import numpy as npwidthImg=480
heightImg =640img = cv2.imread("Resources/1.jpg")"""图像预处理"""
def preProcessing(img):imgGray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)imgBlur = cv2.GaussianBlur(imgGray,(5,5),1)imgCanny = cv2.Canny(imgBlur,200,200)kernel = np.ones((5,5))imgDial = cv2.dilate(imgCanny,kernel,iterations=2)imgThres = cv2.erode(imgDial,kernel,iterations=1)return imgThres'''获取最大轮廓角点'''
def getContours(img):biggest = np.array([])maxArea = 0contours,Heriachy= cv2.findContours(img,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE)for cnt in contours:area = cv2.contourArea(cnt)if area>5000:peri = cv2.arcLength(cnt,True)approx = cv2.approxPolyDP(cnt,0.02*peri,True)if area >maxArea and len(approx) == 4:biggest = approxmaxArea = area#绘制轮廓(biggest仅仅包含矩形的轮廓)cv2.drawContours(imgContour, biggest, -1, (255, 0, 0), 20)return biggest'''矩形角点的重新处理:按照一定的顺序排列(左上,右上,左下,右下)'''
def reorder (myPoints):myPoints = myPoints.reshape((4,2))#四个角点myPointsNew = np.zeros((4,1,2),np.int32)#点按照一定的顺序重新排列add = myPoints.sum(1)#将点进行x+y计算,myPointsNew[0] = myPoints[np.argmin(add)] #和最小的点为左上角点myPointsNew[3] = myPoints[np.argmax(add)]#和最大的点为右下角点diff = np.diff(myPoints,axis=1)#将点进行x-y差异计算myPointsNew[1]= myPoints[np.argmin(diff)]#差异最小的点为右上myPointsNew[2] = myPoints[np.argmax(diff)]#差异最大的点为左下return myPointsNew'''鸟瞰转换'''
def getWarp(img,biggest):#矩阵角点的处理,按照一个统一顺序排列biggest = reorder(biggest)pts1 = np.float32(biggest)pts2 = np.float32([[0, 0], [widthImg, 0], [0, heightImg], [widthImg, heightImg]])matrix = cv2.getPerspectiveTransform(pts1, pts2)#鸟瞰图imgOutput = cv2.warpPerspective(img, matrix, (widthImg, heightImg))#得到的鸟瞰图,边缘有其他背景,所以裁剪边缘,并将裁剪后的图像,重新调整为原来窗口大小。imgCropped = imgOutput[20:imgOutput.shape[0]-20,20:imgOutput.shape[1]-20]imgCropped = cv2.resize(imgCropped,(widthImg,heightImg))return imgCropped'''图像堆叠显示'''
def stackImages(scale,imgArray):rows = len(imgArray)cols = len(imgArray[0])rowsAvailable = isinstance(imgArray[0], list)width = imgArray[0][0].shape[1]height = imgArray[0][0].shape[0]if rowsAvailable:for x in range ( 0, rows):for y in range(0, cols):if imgArray[x][y].shape[:2] == imgArray[0][0].shape [:2]:imgArray[x][y] = cv2.resize(imgArray[x][y], (0, 0), None, scale, scale)else:imgArray[x][y] = cv2.resize(imgArray[x][y], (imgArray[0][0].shape[1], imgArray[0][0].shape[0]), None, scale, scale)if len(imgArray[x][y].shape) == 2: imgArray[x][y]= cv2.cvtColor( imgArray[x][y], cv2.COLOR_GRAY2BGR)imageBlank = np.zeros((height, width, 3), np.uint8)hor = [imageBlank]*rowshor_con = [imageBlank]*rowsfor x in range(0, rows):hor[x] = np.hstack(imgArray[x])ver = np.vstack(hor)else:for x in range(0, rows):if imgArray[x].shape[:2] == imgArray[0].shape[:2]:imgArray[x] = cv2.resize(imgArray[x], (0, 0), None, scale, scale)else:imgArray[x] = cv2.resize(imgArray[x], (imgArray[0].shape[1], imgArray[0].shape[0]), None,scale, scale)if len(imgArray[x].shape) == 2: imgArray[x] = cv2.cvtColor(imgArray[x], cv2.COLOR_GRAY2BGR)hor= np.hstack(imgArray)ver = horreturn verwhile True:imgresize = cv2.resize(img,(widthImg,heightImg))imgContour = imgresize.copy()imgThres = preProcessing(imgresize)biggest = getContours(imgThres)if biggest.size != 0:# 鸟瞰转换imgWarped = getWarp(imgresize, biggest)imageArray = ([imgresize,imgThres],[imgContour,imgWarped])cv2.imshow("ImageWarped", imgWarped)else:imageArray = ([imgContour, img])# 图像堆叠显示stackedImages = stackImages(0.5, imageArray)cv2.imshow("WorkFlow", stackedImages)cv2.waitKey(0)

在这里插入图片描述

10.3 车牌检测器

import cv2frameWidth = 640
frameHeight = 480
nPlateCascade = cv2.CascadeClassifier("Resources/haarcascade_russian_plate_number.xml")
minArea = 200
color = (255,0,255)cap = cv2.VideoCapture(0)
cap.set(3, frameWidth)
cap.set(4, frameHeight)
cap.set(10,150)
count = 0while True:success, img = cap.read() imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) #车牌检测numberPlates = nPlateCascade.detectMultiScale(imgGray, 1.1, 10)for (x, y, w, h) in numberPlates:area = w*hif area >minArea:#绘制矩形cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 255), 2)#绘制文字cv2.putText(img,"Number Plate",(x,y-5),cv2.FONT_HERSHEY_COMPLEX_SMALL,1,color,2)imgRoi = img[y:y+h,x:x+w]cv2.imshow("ROI", imgRoi)cv2.imshow("Result", img)if cv2.waitKey(1) & 0xFF == ord('s'):cv2.imwrite("Resources/Scanned/NoPlate_"+str(count)+".jpg",imgRoi)cv2.rectangle(img,(0,200),(640,300),(0,255,0),cv2.FILLED)cv2.putText(img,"Scan Saved",(150,265),cv2.FONT_HERSHEY_DUPLEX,2,(0,0,255),2)cv2.imshow("Result",img)cv2.waitKey(500)count +=1break

在这里插入图片描述

按s键后可保存车牌

在这里插入图片描述

参考资料

ChatGPT (openai.com)

RGB Color Codes Chart 🎨 (rapidtables.com)

图像基本操作 - 【布客】OpenCV 4.0.0 中文翻译 (apachecn.org)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/62080.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

微信小程序发布一个npm包

参考:https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html 同npm一样流程 npm install weixin_heath_apis

MySQL 8.1.0 推出 InnoDB Cluster 只读副本

全面了解 8.1.0 版本新功能&#xff1a;InnoDB Cluster 只读副本的相关操作。 作者&#xff1a;Miguel Arajo 高级软件工程师 / Kenny Gryp MySQL 产品总监 本文来源&#xff1a;Oracle MySQL 官网博客 * 爱可生开源社区出品。 前言 MySQL 的第一个 Innovation 版本 8.1.0 已…

基于JAVA SpringBoot和HTML婴幼儿商品商城设计

摘要 随着网络技术的发展与普遍,人们的生活发生了日新月异的变化,特别是计算机的应用已经普及到经济和社会的各个领域.为了让消费者网上购物过程变得简单,方便,安全,快捷,网上商城购物成了一种新型而热门的购物方式。网上商城在商品销售的发展中占据了重要的地位,已成为商家展示…

【大数据】数据湖:下一代大数据的发展趋势

数据湖&#xff1a;下一代大数据的发展趋势 1.数据湖技术产生的背景1.1 离线大数据平台&#xff08;第一代&#xff09;1.2 Lambda 架构1.3 Lambda 架构的痛点1.4 Kappa 架构1.5 Kappa 架构的痛点1.6 大数据架构痛点总结1.7 实时数仓建设需求 2.数据湖助力于解决数据仓库痛点问…

5 大虚拟数字人工具:视频内容创作的未来

人工智能&#xff08;AI&#xff09;给视频内容创作领域带来了一场革命。这一领域的显着进步之一是人工智能生成的会说话的化身的出现&#xff0c;它已经成为制作高质量视频的游戏规则改变者&#xff0c;而无需专业演员或昂贵的视频编辑软件。在这篇博文中&#xff0c;我们将深…

java八股文面试[多线程]——一个线程两次调用start()方法会出现什么情况

典型回答&#xff1a; Java 的线程是不允许启动两次的&#xff0c;第二次调用必然会抛出 IllegalThreadStateException&#xff0c;这是一种运行时异常&#xff0c;多次调用 start 被认为是编程错误。 通过线程的状态图&#xff0c;在第二次调用 start() 方法的时候&#xff…

发表于《自然》杂志:语音转文本BCI的新突破实现62字/分钟的速度

语音脑机接口&#xff08;BCI&#xff09;是一项创新技术&#xff0c;通过用户的大脑信号在用户和某些设备之间建立通信通道&#xff0c;它们在恢复残疾患者的言语和通信能力方面具有巨大潜力。 早期的研究虽然很有希望&#xff0c;但尚未达到足够高的精度来解码大脑活动&…

【斗罗Ⅱ】演员阵容曝光,张予曦披发惊艳,奥斯卡选角出新变革

Hello,小伙伴们&#xff0c;我是小郑继续为大家深度解析国漫&#xff01; 由周翊然和张予曦主演的《斗罗大陆2》电视剧&#xff0c;目前还在拍摄中。和第一部相比&#xff0c;主演阵容来了个全员大换血。服化道有参考动漫&#xff0c;但是做出来的质感&#xff0c;却引起了很多…

Mycat之前世今生

如果我有一个32核心的服务器&#xff0c;我就可以实现1个亿的数据分片&#xff0c;我有32核心的服务器么&#xff1f;没有&#xff0c;所以我至今无法实现1个亿的数据分片。——MyCAT ‘s Plan 话说“每一个成功的男人背后都有一个女人”&#xff0c;自然MyCAT也逃脱不了这个诅…

Flutter的未来与趋势,23年还学吗?

随着移动应用市场的不断扩大&#xff0c;跨平台开发框架的需求也越来越大。Flutter框架可以帮助开发者在不同平台上快速开发高质量的移动应用程序&#xff0c;这种趋势将进一步推动Flutter的发展和普及。 作为一名前端开发工程师&#xff0c;学习Flutter框架是非常有必要的。因…

链表OJ练习(1)

一、移除链表元素 本题为力扣原题203 题目介绍&#xff1a; 给你一个链表的头节点 head 和一个整数 val &#xff0c;请你删除链表中所有满足 Node.val val 的节点&#xff0c;并返回 新的头节点 。 列表中的节点数目范围在 0~10000内 1<Node.val<50 0<val<50 …

构建简单的Node.js HTTP服务器,发布公网远程访问的快速方法

文章目录 前言1.安装Node.js环境2.创建node.js服务3. 访问node.js 服务4.内网穿透4.1 安装配置cpolar内网穿透4.2 创建隧道映射本地端口 5.固定公网地址 前言 Node.js 是能够在服务器端运行 JavaScript 的开放源代码、跨平台运行环境。Node.js 由 OpenJS Foundation&#xff0…

【附安装包】Substance3D 2022安装教程

软件下载 软件&#xff1a;Substance3D版本&#xff1a;2022语言&#xff1a;简体中文大小&#xff1a;4.0G安装环境&#xff1a;Win11/Win10&#xff08;1809版本以上&#xff09;硬件要求&#xff1a;CPU2.0GHz 内存4G(或更高&#xff0c;不支持7代以下CPU&#xff09;下载通…

thinkphp6 入门(2)--视图、渲染html页面、赋值

修改模板引擎 config/view.php // 模板引擎类型使用Think type > php, 2. 新建一个控制器 本文app的名称为test&#xff0c;在其下新建一个控制器User app/test/controller/User.php 注意&#xff1a;需要引用think\facade\View来操作视图 <?phpnamespace app\te…

h5 ws 客户端 监听ws服务器广播的信息

<!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><title>AI智能写作</title><!-- Bootstrap CSS --><meta charset"utf-8"><meta name"viewport" content"widt…

K8s的Pod出现Init:ImagePullBackOff问题的解决(以calico为例)

对于这类问题的解决思路应该都差不多&#xff0c;本文以calico插件安装为例&#xff0c;发现有个Pod的镜像没有pull成功 第一步&#xff1a;查看这个pod的描述信息 kubectl describe pod calico-node-wmhrw -n kube-system 从上图发现是docker拉取"calico/cni:v3.15.1&q…

Ubuntu 20.04.5 怎么安装微信

这是我的ubutun版本号 在这个系统装桌面版微信很多功能不健全。搜索了很多方法&#xff0c;这个算是不错的一个法子。 1.添加仓库 首次使用时&#xff0c;你需要运行如下一条命令将移植仓库添加到系统中。 wget -O- https://deepin-wine.i-m.dev/setup.sh | sh 2.应用安装 …

【C语言】文件操作详解

文章目录 前言一、文件是什么二、文件具体介绍1.文件名2.文件类型3.文件缓冲区4.文件指针5.文件的打开和关闭 三、文件的顺序读写1.字符输入函数&#xff08;fgetc&#xff09;2.字符输出函数&#xff08;fputc&#xff09;3.文本行输入函数&#xff08;fgets&#xff09;4.文本…

基于MQTT协议的物联网关

随着工业领域的不断发展&#xff0c;数字化转型已经成为企业迈向未来的必由之路。在这个数字化浪潮中&#xff0c;HiWoo Box以其强大的功能和创新的设计&#xff0c;在工业物联网领域被越来越多的人所熟知。特别是其基于MQTT协议的物联网关能力&#xff0c;也为企业实现智能化数…

Centos7本地安装Docker-compose

考虑github时常出现问题。以下内容是基于本地安装 安装包地址 文章参考链接 1、下载安装包上传包到/usr/local/bin 2、执行命令 # 修改权限 chmod x /usr/local/bin/docker-compose ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose3、验证是否安装成功 docker-…