当前位置: 首页 > news >正文

Python——添加照片边框

原图:

在这里插入图片描述

添加边框后:

在这里插入图片描述添加边框会读取照片的exif信息如时间、相机型号、品牌以及快门焦段等信息,将他们显示在下面的边框中。

获取当前py文件路径

import os
#get path that py file located
def Get_Currentpath():file_path = os.path.abspath(__file__)dir_path = os.path.dirname(file_path)return dir_path

弹窗获取所选择文件路径

如下图使用tkinter库掉出弹窗选择指定图片,并获取所选择图片的绝对路径

在这里插入图片描述

import tkinter 
#get file path that choosed
def Get_FilePath():root = tkinter.Tk()root.withdraw()f_path = filedialog.askopenfilename()return f_path

弹窗获取用户所选择的保存路径

将处理后的图片存储到所选的路径并指定文件名

在这里插入图片描述

def save_filePath():# 创建文件对话框root = tkinter.Tk()root.withdraw()# 弹出保存文件对话框file_path = filedialog.asksaveasfilename(defaultextension=".jpg", filetypes=[("JPG File", "*.jpg"), ("PNG file","*.png"),("All Files", "*.*")])print(file_path)# 如果用户选择了文件路径,则返回路径if file_path:return file_pathelse:pass

创建文字图片

def createfond(size=160,str=' ',color=(0,0,0)):lopath = Get_Currentpath()fondpath = lopath+r'\material\方正楷体简体.TTF'dignum=0alphanum=0othernum=0for i in str:if i.isdigit():dignum+=1elif i.isalpha():alphanum+=1else:othernum+=1`在这里插入代码片`othernum = len(str)-dignumx=int(dignum*size*0.6)+int(alphanum*size*0.6)+int(othernum*size*0.5)y=int(size*1.2)img = Image.new("RGBA",(x,y),'white')draw = ImageDraw.Draw(img)#创建一个绘画对象fnt = ImageFont.truetype(fondpath,size)draw.text((0,0),str,fill=color,font=fnt)#img.show()return img,x,y

获取字体ttf文件路径

fondpath = lopath+r'\material\方正楷体简体.TTF'

计算文字所占用的空间大小从而生成合适大小的image图像

   x=int(dignum*size*0.6)+int(alphanum*size*0.6)+int(othernum*size*0.5)y=int(size*1.2)img = Image.new("RGBA",(x,y),'white')

使用imageDraw 和 ImageFont方法在image图像上写文本

from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw    draw = ImageDraw.Draw(img)#创建一个绘画对象
fnt = ImageFont.truetype(fondpath,size)
draw.text((0,0),str,fill=color,font=fnt)

生成文字图片如下
在这里插入图片描述

最后返回的是处理好的文本图像变量和图像的长和高

return img,x,y

创建边框

#creat the border
def CreateBorder(logopath,color = (255,255,255)):Src_path = Get_FilePath()pictype = picturetype.picturesize.size_16_9img = Image.open(Src_path)#get exif dataexif_dict = piexif.load(Src_path)exif_bytes = piexif.dump(exif_dict)exif_mes = img._getexif()# 获取时间信息if "Exif" in exif_dict:exif_data = exif_dict["Exif"]#拍摄日期if piexif.ExifIFD.DateTimeOriginal in exif_data:datetime_original_0 = str(exif_data[piexif.ExifIFD.DateTimeOriginal].decode("utf-8"))#print("DateTimeOriginal:", datetime_original)datetime_original = datetime_original_0.replace(':','.',2)datetime_original = datetime_original[0:10]print(datetime_original)else:   datetime_original = ' '#焦距if piexif.ExifIFD.FocalLength in exif_data:FocalLength = str(int(exif_data[piexif.ExifIFD.FocalLength][0]/100))+"mm"#print("focal length:",FocalLength)else:FocalLength = ' '#ISOif piexif.ExifIFD.ISOSpeedRatings in exif_data:ISO = 'ISO'+str(exif_data[piexif.ExifIFD.ISOSpeedRatings])#print("ISO:",ISO)else:ISO = ' '#快门时间if piexif.ExifIFD.ExposureTime in exif_data:exposure_time = exif_data[piexif.ExifIFD.ExposureTime]shutter_speed = exposure_time[0] / exposure_time[1]shutter_speed = int(1/shutter_speed)shutter_speed = '1/'+str(shutter_speed)+'s'else:shutter_speed = ' '#光圈if piexif.ExifIFD.FNumber in exif_data:f_number = exif_data[piexif.ExifIFD.FNumber]fnumber = 'f/'+str(int(f_number[0] / f_number[1]))#print("光圈",fnumber)else:fnumber = ' '#镜头品牌if piexif.ExifIFD.LensMake in exif_data:lensmaker = exif_data[piexif.ExifIFD.LensMake].decode("utf-8")#print('镜头品牌:',lensmaker)else:lensmaker = ' '#镜头型号if piexif.ExifIFD.LensModel in exif_data:lensmodel = exif_data[piexif.ExifIFD.LensModel].decode("utf-8")#print("镜头型号",lensmodel)else:lensmodel = ' 'camera_model = str(exif_dict["0th"].get(piexif.ImageIFD.Model).decode("utf-8"))camera_make = str(exif_dict["0th"].get(piexif.ImageIFD.Make).decode("utf-8"))print(camera_make,camera_model)signature = "Photo by mohuijun"else:pass#get width and highPicWidth = img.size[0]PicHigh = img.size[1]#picture is 16:9if int(PicWidth/16)==int(PicHigh/9):pictype = picturetype.picturesize.size_16_9lowwidth = int(PicWidth/3*2-PicHigh)Highwidth = 0letfWidth = 0rightwidth = 0borderhigh = lowwidthborderwide = PicWidthlogoimg = Image.open(logopath)logowidth = int(PicWidth/7)logohigh = int(logowidth/4.3)logoimg.thumbnail((logowidth,logohigh))#create new picNewPicWidth = PicWidth + letfWidth + rightwidthNewPicHigh = PicHigh + Highwidth + lowwidth#logo locationlogo_x = int(borderwide/20*11)logo_y = int((borderhigh-logohigh)/2)+PicHigh#create new pictureimg_new = Image.new('RGB', (NewPicWidth, NewPicHigh), color)#create exif messageimg_focallength,focallengthwid,focallengthhigh = createfond(size=120,str=FocalLength)img_data,datawid,datahigh = createfond(size=90,str=signature+' on '+datetime_original,color=(120,120,120))img_ISO,ISOwid,ISOhigh = createfond(size=120,str=ISO)img_shuttime,shutwid,shuthigh = createfond(size=120,str=shutter_speed)img_FNnumber,FNnumberwid,FNnumberhigh = createfond(size=120,str=fnumber)img_Lens,lenwid,lenhigh = createfond(size=90,str=(lensmaker+'·'+lensmodel),color=(120,120,120))# create '|'img_symbal,symbalwid,symbalhigh = createfond(size=350,str='|',color=(180,180,180))#create camera modeimg_camera,camerawid,camerahigh = createfond(150,str = camera_make+' '+camera_model)#create signature#img_signature,signaturewid,signaturehigh = createfond(size = 100,str = signature,color=(120,120,120))symbal_x = logo_x+logowidthsymbal_y = int((borderhigh-symbalhigh)/2)+PicHigh#exif message locationfocallength_x = symbal_x+symbalwidfocallength_y = symbal_y+int(symbalhigh/10)FNnumber_x = focallength_x+focallengthwidFNnumber_y = symbal_y+int(symbalhigh/10)shuttime_x = FNnumber_x+FNnumberwidshuttime_y = symbal_y+int(symbalhigh/10)ISO_x = shuttime_x+shutwidISO_y = symbal_y+int(symbalhigh/10)data_x = focallength_xdata_y = symbal_y+int(symbalhigh/3*2)Lens_x = 100Lens_y = symbal_y+int(symbalhigh/3*2)camera_x = 100camera_y = symbal_y+int(symbalhigh/5)img_new.paste(img, (letfWidth, Highwidth))#paste logoimg_new.paste(logoimg,(logo_x,logo_y))#paste exif messageimg_new.paste(img_focallength,(focallength_x,focallength_y))#img_new.paste(img_data,(data_x,data_y))img_new.paste(img_FNnumber,(FNnumber_x,FNnumber_y))img_new.paste(img_ISO,(ISO_x,ISO_y))img_new.paste(img_shuttime,(shuttime_x,shuttime_y))img_new.paste(img_Lens,(Lens_x,Lens_y))img_new.paste(img_data,(data_x,data_y))img_new.paste(img_symbal,(symbal_x,symbal_y))img_new.paste(img_camera,(camera_x,camera_y))Des_path = save_filePath()try:img_new.save(Des_path,exif=exif_bytes)except:print("地址无效")

获取所选图像绝对路径并打开

  Src_path = Get_FilePath()pictype = picturetype.picturesize.size_16_9img = Image.open(Src_path)

使用piexif库获取图片的exif信息,得到拍摄时间、相机型号、光圈、快门等数据信息

import piexif#get exif data
exif_dict = piexif.load(Src_path)
exif_bytes = piexif.dump(exif_dict)
exif_mes = img._getexif()
# 获取时间信息
if "Exif" in exif_dict:exif_data = exif_dict["Exif"]#拍摄日期if piexif.ExifIFD.DateTimeOriginal in exif_data:datetime_original_0 = str(exif_data[piexif.ExifIFD.DateTimeOriginal].decode("utf-8"))#print("DateTimeOriginal:", datetime_original)datetime_original = datetime_original_0.replace(':','.',2)datetime_original = datetime_original[0:10]print(datetime_original)else:   datetime_original = ' '#焦距if piexif.ExifIFD.FocalLength in exif_data:FocalLength = str(int(exif_data[piexif.ExifIFD.FocalLength][0]/100))+"mm"#print("focal length:",FocalLength)else:FocalLength = ' '#ISOif piexif.ExifIFD.ISOSpeedRatings in exif_data:ISO = 'ISO'+str(exif_data[piexif.ExifIFD.ISOSpeedRatings])#print("ISO:",ISO)else:ISO = ' '#快门时间if piexif.ExifIFD.ExposureTime in exif_data:exposure_time = exif_data[piexif.ExifIFD.ExposureTime]shutter_speed = exposure_time[0] / exposure_time[1]shutter_speed = int(1/shutter_speed)shutter_speed = '1/'+str(shutter_speed)+'s'else:shutter_speed = ' '#光圈if piexif.ExifIFD.FNumber in exif_data:f_number = exif_data[piexif.ExifIFD.FNumber]fnumber = 'f/'+str(int(f_number[0] / f_number[1]))#print("光圈",fnumber)else:fnumber = ' '#镜头品牌if piexif.ExifIFD.LensMake in exif_data:lensmaker = exif_data[piexif.ExifIFD.LensMake].decode("utf-8")#print('镜头品牌:',lensmaker)else:lensmaker = ' '#镜头型号if piexif.ExifIFD.LensModel in exif_data:lensmodel = exif_data[piexif.ExifIFD.LensModel].decode("utf-8")#print("镜头型号",lensmodel)else:lensmodel = ' 'camera_model = str(exif_dict["0th"].get(piexif.ImageIFD.Model).decode("utf-8"))camera_make = str(exif_dict["0th"].get(piexif.ImageIFD.Make).decode("utf-8"))print(camera_make,camera_model)signature = "Photo by mohuijun"
else:pass

获取图片的高和宽度,计算照片比例,如果原图为16:9则填充边框变成3:2

  #get width and highPicWidth = img.size[0]PicHigh = img.size[1]#picture is 16:9if int(PicWidth/16)==int(PicHigh/9):pictype = picturetype.picturesize.size_16_9lowwidth = int(PicWidth/3*2-PicHigh)Highwidth = 0letfWidth = 0rightwidth = 0borderhigh = lowwidthborderwide = PicWidth

依据相机品牌logo的路径获取相机品牌logo图像

    #get logo piclogoimg = Image.open(logopath)logowidth = int(PicWidth/7)logohigh = int(logowidth/4.3)logoimg.thumbnail((logowidth,logohigh))#create new picNewPicWidth = PicWidth + letfWidth + rightwidthNewPicHigh = PicHigh + Highwidth + lowwidth#logo locationlogo_x = int(borderwide/20*11)logo_y = int((borderhigh-logohigh)/2)+PicHigh

在这里插入图片描述
创建一个信息图片image作为处理后的图片

    #create new pictureimg_new = Image.new('RGB', (NewPicWidth, NewPicHigh), color)

使用上面所述的创建文字图像方法依次创建相机信息的图像

    #create exif messageimg_focallength,focallengthwid,focallengthhigh = createfond(size=120,str=FocalLength)img_data,datawid,datahigh = createfond(size=90,str=signature+' on '+datetime_original,color=(120,120,120))img_ISO,ISOwid,ISOhigh = createfond(size=120,str=ISO)img_shuttime,shutwid,shuthigh = createfond(size=120,str=shutter_speed)img_FNnumber,FNnumberwid,FNnumberhigh = createfond(size=120,str=fnumber)img_Lens,lenwid,lenhigh = createfond(size=90,str=(lensmaker+'·'+lensmodel),color=(120,120,120))# create '|'img_symbal,symbalwid,symbalhigh = createfond(size=350,str='|',color=(180,180,180))#create camera modeimg_camera,camerawid,camerahigh = createfond(150,str = camera_make+' '+camera_model)

计算文字图像需要摆放的位置

    symbal_x = logo_x+logowidthsymbal_y = int((borderhigh-symbalhigh)/2)+PicHigh#exif message locationfocallength_x = symbal_x+symbalwidfocallength_y = symbal_y+int(symbalhigh/10)FNnumber_x = focallength_x+focallengthwidFNnumber_y = symbal_y+int(symbalhigh/10)shuttime_x = FNnumber_x+FNnumberwidshuttime_y = symbal_y+int(symbalhigh/10)ISO_x = shuttime_x+shutwidISO_y = symbal_y+int(symbalhigh/10)data_x = focallength_xdata_y = symbal_y+int(symbalhigh/3*2)Lens_x = 100Lens_y = symbal_y+int(symbalhigh/3*2)camera_x = 100camera_y = symbal_y+int(symbalhigh/5)

效果图下
在这里插入图片描述

将所有文字图像和原图按照指定位置和大小复制到新的图像中

    #paste orignial pictureimg_new.paste(img, (letfWidth, Highwidth))#paste logoimg_new.paste(logoimg,(logo_x,logo_y))#paste exif messageimg_new.paste(img_focallength,(focallength_x,focallength_y))#img_new.paste(img_data,(data_x,data_y))img_new.paste(img_FNnumber,(FNnumber_x,FNnumber_y))img_new.paste(img_ISO,(ISO_x,ISO_y))img_new.paste(img_shuttime,(shuttime_x,shuttime_y))img_new.paste(img_Lens,(Lens_x,Lens_y))img_new.paste(img_data,(data_x,data_y))img_new.paste(img_symbal,(symbal_x,symbal_y))img_new.paste(img_camera,(camera_x,camera_y))

获取保存路径并保存

    Des_path = save_filePath()try:img_new.save(Des_path,exif=exif_bytes)except:print("地址无效")

主函数 创建图片边框

Local_path = Get_Currentpath()
LOGOPATH = Local_path+r'\material\fujifilmlogo.jpg'
CreateBorder(logopath=LOGOPATH)

附全部代码

import tkinter 
import os
from tkinter import filedialog
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import exifread
import piexif
#get path that py file located
def Get_Currentpath():file_path = os.path.abspath(__file__)dir_path = os.path.dirname(file_path)return dir_path
#get file path that choosed
def Get_FilePath():root = tkinter.Tk()root.withdraw()f_path = filedialog.askopenfilename()return f_path
#set path to  save
def save_filePath():# 创建文件对话框root = tkinter.Tk()root.withdraw()# 弹出保存文件对话框file_path = filedialog.asksaveasfilename(defaultextension=".jpg", filetypes=[("JPG File", "*.jpg"), ("PNG file","*.png"),("All Files", "*.*")])print(file_path)# 如果用户选择了文件路径,则返回路径if file_path:return file_pathelse:pass
#create font
def createfond(size=160,str=' ',color=(0,0,0)):lopath = Get_Currentpath()fondpath = lopath+r'\material\方正楷体简体.TTF'dignum=0alphanum=0othernum=0for i in str:if i.isdigit():dignum+=1elif i.isalpha():alphanum+=1else:othernum+=1othernum = len(str)-dignumx=int(dignum*size*0.6)+int(alphanum*size*0.6)+int(othernum*size*0.5)y=int(size*1.2)img = Image.new("RGBA",(x,y),'white')draw = ImageDraw.Draw(img)#创建一个绘画对象fnt = ImageFont.truetype(fondpath,size)draw.text((0,0),str,fill=color,font=fnt)#img.show()return img,x,y
#creat the border
def CreateBorder(logopath,color = (255,255,255)):Src_path = Get_FilePath()pictype = picturetype.picturesize.size_16_9img = Image.open(Src_path)#get exif dataexif_dict = piexif.load(Src_path)exif_bytes = piexif.dump(exif_dict)exif_mes = img._getexif()# if exif_mes is not None:#         camera_info = exif_mes.get(0x010F)  # 0x010F表示相机品牌和型号的标记#         print(camera_info)# 获取时间信息if "Exif" in exif_dict:exif_data = exif_dict["Exif"]#拍摄日期if piexif.ExifIFD.DateTimeOriginal in exif_data:datetime_original_0 = str(exif_data[piexif.ExifIFD.DateTimeOriginal].decode("utf-8"))#print("DateTimeOriginal:", datetime_original)datetime_original = datetime_original_0.replace(':','.',2)datetime_original = datetime_original[0:10]print(datetime_original)else:   datetime_original = ' '#焦距if piexif.ExifIFD.FocalLength in exif_data:FocalLength = str(int(exif_data[piexif.ExifIFD.FocalLength][0]/100))+"mm"#print("focal length:",FocalLength)else:FocalLength = ' '#ISOif piexif.ExifIFD.ISOSpeedRatings in exif_data:ISO = 'ISO'+str(exif_data[piexif.ExifIFD.ISOSpeedRatings])#print("ISO:",ISO)else:ISO = ' '#快门时间if piexif.ExifIFD.ExposureTime in exif_data:exposure_time = exif_data[piexif.ExifIFD.ExposureTime]shutter_speed = exposure_time[0] / exposure_time[1]shutter_speed = int(1/shutter_speed)shutter_speed = '1/'+str(shutter_speed)+'s'else:shutter_speed = ' '#光圈if piexif.ExifIFD.FNumber in exif_data:f_number = exif_data[piexif.ExifIFD.FNumber]fnumber = 'f/'+str(int(f_number[0] / f_number[1]))#print("光圈",fnumber)else:fnumber = ' '#镜头品牌if piexif.ExifIFD.LensMake in exif_data:lensmaker = exif_data[piexif.ExifIFD.LensMake].decode("utf-8")#print('镜头品牌:',lensmaker)else:lensmaker = ' '#镜头型号if piexif.ExifIFD.LensModel in exif_data:lensmodel = exif_data[piexif.ExifIFD.LensModel].decode("utf-8")#print("镜头型号",lensmodel)else:lensmodel = ' '# if  piexif.ExifIFD. in exif_data:#     makernote = exif_data[piexif.ExifIFD.DeviceSettingDescription].decode("utf-8")#     print("相机:",makernote)#get camera modecamera_model = str(exif_dict["0th"].get(piexif.ImageIFD.Model).decode("utf-8"))#camera_model = camera_model[2:-1]camera_make = str(exif_dict["0th"].get(piexif.ImageIFD.Make).decode("utf-8"))#camera_make = camera_make[2:-1]print(camera_make,camera_model)#get camera maker#print("camera:",camera_model)signature = "Photo by mohuijun"else:pass#get width and highPicWidth = img.size[0]PicHigh = img.size[1]#picture is 16:9if int(PicWidth/16)==int(PicHigh/9):lowwidth = int(PicWidth/3*2-PicHigh)Highwidth = 0letfWidth = 0rightwidth = 0borderhigh = lowwidthborderwide = PicWidth#create border#get logo piclogoimg = Image.open(logopath)logowidth = int(PicWidth/7)logohigh = int(logowidth/4.3)logoimg.thumbnail((logowidth,logohigh))#create new picNewPicWidth = PicWidth + letfWidth + rightwidthNewPicHigh = PicHigh + Highwidth + lowwidth#logo locationlogo_x = int(borderwide/20*11)logo_y = int((borderhigh-logohigh)/2)+PicHigh#create new pictureimg_new = Image.new('RGB', (NewPicWidth, NewPicHigh), color)#create exif messageimg_focallength,focallengthwid,focallengthhigh = createfond(size=120,str=FocalLength)img_data,datawid,datahigh = createfond(size=90,str=signature+' on '+datetime_original,color=(120,120,120))img_ISO,ISOwid,ISOhigh = createfond(size=120,str=ISO)img_shuttime,shutwid,shuthigh = createfond(size=120,str=shutter_speed)img_FNnumber,FNnumberwid,FNnumberhigh = createfond(size=120,str=fnumber)img_Lens,lenwid,lenhigh = createfond(size=90,str=(lensmaker+'·'+lensmodel),color=(120,120,120))# create '|'img_symbal,symbalwid,symbalhigh = createfond(size=350,str='|',color=(180,180,180))#create camera modeimg_camera,camerawid,camerahigh = createfond(150,str = camera_make+' '+camera_model)#create signature#img_signature,signaturewid,signaturehigh = createfond(size = 100,str = signature,color=(120,120,120))symbal_x = logo_x+logowidthsymbal_y = int((borderhigh-symbalhigh)/2)+PicHigh#exif message locationfocallength_x = symbal_x+symbalwidfocallength_y = symbal_y+int(symbalhigh/10)FNnumber_x = focallength_x+focallengthwidFNnumber_y = symbal_y+int(symbalhigh/10)shuttime_x = FNnumber_x+FNnumberwidshuttime_y = symbal_y+int(symbalhigh/10)ISO_x = shuttime_x+shutwidISO_y = symbal_y+int(symbalhigh/10)data_x = focallength_xdata_y = symbal_y+int(symbalhigh/3*2)Lens_x = 100Lens_y = symbal_y+int(symbalhigh/3*2)# signature_x = 100# signature_y = Lens_ycamera_x = 100camera_y = symbal_y+int(symbalhigh/5)#paste singnature picture#img_new.paste(img_signature,(signature_x,signature_y))#paste orignial pictureimg_new.paste(img, (letfWidth, Highwidth))#paste logoimg_new.paste(logoimg,(logo_x,logo_y))#paste exif messageimg_new.paste(img_focallength,(focallength_x,focallength_y))#img_new.paste(img_data,(data_x,data_y))img_new.paste(img_FNnumber,(FNnumber_x,FNnumber_y))img_new.paste(img_ISO,(ISO_x,ISO_y))img_new.paste(img_shuttime,(shuttime_x,shuttime_y))img_new.paste(img_Lens,(Lens_x,Lens_y))img_new.paste(img_data,(data_x,data_y))img_new.paste(img_symbal,(symbal_x,symbal_y))img_new.paste(img_camera,(camera_x,camera_y))Des_path = save_filePath()try:img_new.save(Des_path,exif=exif_bytes)except:print("地址无效")Local_path = Get_Currentpath()
LOGOPATH = Local_path+r'\material\fujifilmlogo.jpg'
CreateBorder(logopath=LOGOPATH)

相关文章:

Python——添加照片边框

原图: 添加边框后: 添加边框会读取照片的exif信息如时间、相机型号、品牌以及快门焦段等信息,将他们显示在下面的边框中。 获取当前py文件路径 import os #get path that py file located def Get_Currentpath():file_path os.path.abspa…...

《高性能MySQL》——查询性能优化(笔记)

文章目录 六、查询性能优化6.1 查询为什么会慢6.2 慢查询基础:优化数据访问6.2.1 是否向数据库请求了不需要的数据查询不需要的记录多表关联时返回全部列总是取出全部列重复查询相同的数据 6.2.2 MySQL 是否在扫描额外的记录响应时间扫描的行数与返回的行数扫描的行…...

【Linux操作系统】编译过程中遇到的问题-为什么加-c?执行文件提示无法执行二进制文件?main函数参数argc和*argv[]的作用和理解?

在使用GCC编译器进行程序开发时,我们经常会遇到一些编译过程中的问题, 比如为什么要加上"-c"选项,以及为什么生成的可执行文件无法执行等问题。 本篇博客将详细介绍这些问题,并给出相应的代码和解释,帮助读者…...

【数据结构与算法——TypeScript】图结构(Graph)

【数据结构与算法——TypeScript】 图结构(Graph) 认识图结构以及特性 什么是图? 在计算机程序设计中,图结构 也是一种非常常见的数据结构。 但是,图论其实是一个非常大的话题 认识一下关于图的一些内容 图的抽象数据类型一些算法实现。 什么是图?…...

C语言字符串拷贝函数详解及示例代码

目录 简介字符串拷贝函数 strcpy字符串拷贝函数 strcpy_s使用示例注意事项结束语 1. 简介 字符串拷贝是C语言中常用的操作之一。当需要将一个字符串复制到另一个字符串数组中时,可以使用字符串拷贝函数来实现。C语言提供了多种字符串拷贝函数,其中最常…...

IntelliJ IDEA热部署:JRebel插件的安装与使用

热部署 概述JRebel 概述 热部署,指修改代码后,无需停止应用程序,即可使修改后的代码生效,其有利于提高开发效率。 热部署方式: 手动热部署:修改代码后,重新编译项目,然后启动应用程…...

iTOP-3568开发板使用OpenCV处理图像-颜色转换

本小节代码在配套资料“iTOP-3568 开发板\03_【iTOP-RK3568 开发板】指南教程 \04_OpenCV 开发配套资料\05”目录下,如下图所示: cv2.cvtColor()函数功能: 将一幅图像从一个色彩空间转换到另一个色彩空间。 函数原型: cv2.cvt…...

Python技巧----解压序列/可迭代对象赋值给多个变量

1 、解压序列赋值给多个变量 我们这里说的不是正常情况的一一赋值比如下面 >>> data = [ ACME, 5, 9, (2012, 12, 1) ] >>> name, shares, price, date = data >>> name ACME...

16.3.2 【Linux】程序的管理

程序之间是可以互相控制的。举例来说,你可以关闭、重新启动服务器软件,服务器软件本身是个程序, 你既然可以让她关闭或启动,当然就是可以控制该程序。 使用kill-l或者是man 7 signal可以查询到有多少个signal。主要的讯号代号与名…...

Linux命令200例:date用于显示和设置系统的日期和时间

🏆作者简介,黑夜开发者,全栈领域新星创作者✌。CSDN专家博主,阿里云社区专家博主,2023年6月csdn上海赛道top4。 🏆数年电商行业从业经验,历任核心研发工程师,项目技术负责人。 &…...

excel入门

上下左右移动 enter:换行,向下移动 shiftenter:向上移动 tab:向右移动 shifttab:向左移动 合并居中操作 开始-》合并居中 CtrlM 内容过长盖过了下一个单元格内容 双击列与列之间线 同时修改多行或者多列宽度或者高度 修改单行高度宽度 选中某一行拉取指定高…...

单模光纤模场强度分布以及高斯近似的MATLAB仿真

已知纤芯半径5um,数值孔径NA 0.1,波长 用波长和数值孔径计算归一化常数V 之前我们在单模光纤特征方程及其MATLAB数值求解中,用线性关系拟合过V和W,这里直接用拟合结果 U用V和W计算 clc clear close alla 5e-6;%纤芯半径 NA …...

Springboot 在 redis 中使用 BloomFilter 布隆过滤器机制

一、导入SpringBoot依赖 在pom.xml文件中&#xff0c;引入Spring Boot和Redis相关依赖 <!-- Google Guava 使用google的guava布隆过滤器实现--><dependency><groupId>com.google.guava</groupId><artifactId>guava</artifactId><vers…...

什么是管理的本质?

管理不是一门硬科学。与&#xff08;通常&#xff09;存在正确答案的化学或代数不同&#xff0c;管理是流动的&#xff0c;主观的&#xff0c;并且对于如何运用其原理存在不同的观点。但究竟什么是管理&#xff1f;大多数学者都有相同定义的变体&#xff0c;包括利用资源来实现…...

02:STM32--EXTI外部中断

目录 一:中断 1:简历 2:AFIO 3:EXTI ​编辑 4:NVIC基本结构 5:使用步骤 二:中断的应用 A:对外式红外传感计数器 1:连接图​编辑 2:函数介绍 3:硬件介绍 4:计数代码 B;旋转编码计数器 1:连接图 2:硬件介绍 3:旋转编码器代码: 一:中断 1:简历 中断&#xff1a;在主程…...

CLickhouse核心特性

目录 CLickhouse核心特性 1 完备的DBMS功能 2 列式存储与数据压缩 3 向量化执行引擎 4 关系模型与SQL查询 5 多样化的表引擎 6 多线程与分布式 7 多主架构 8 在线查询 9 数据分片与分布式查询 Clickhouse适用场景 Clickhouse不适用场景 Clickhouse名称含义 CLickh…...

如何运用小程序技术闭环运营链路?

如何通过线上小程序获取用户线索&#xff0c;提高企业抗风险能力&#xff0c;建立有效的营销数字化系统一直是困扰每一个小程序开发者与运营者的问题。 当我们选择使用小程序设计自己的运营流程时&#xff0c;从「推广」到「转化」&#xff0c;再到最终的「留存」都是运营过程…...

使用chatGPT-4 畅聊量子物理学(二)

Omer 量子力学的主导哲学或模型或解释是什么&#xff1f; ChatGPT 量子力学是一门描述微观世界中粒子行为的物理学理论&#xff0c;但它的解释和哲学观点在学术界存在多种不同的观点和争议。以下是几种主要的哲学观点或解释&#xff1a; 哥本哈根解释&#xff1a;这是最为广泛…...

读《Flask Web开发实战》(狼书)笔记 | 第1、2章

前言 2023-8-11 以前对网站开发萌生了想法&#xff0c;又有些急于求成&#xff0c;在B站照着视频敲了一个基于flask的博客系统。但对于程序的代码难免有些囫囵吞枣&#xff0c;存在许多模糊或不太理解的地方&#xff0c;只会照葫芦画瓢。 而当自己想开发一个什么网站的时&…...

Tomcat+Http+Servlet

文章目录 1.HTTP1.1 请求和响应HTTP请求&#xff1a;请求行请求头请求体HTTP响应&#xff1a;响应行&#xff08;状态行&#xff09;响应头响应体 2. Apache Tomcat2.1 基本使用2.2 IDEA中创建 Maven Web项目2.3 IDEA中使用Tomcat 3. Servlet3.1 Servlet快速入门3.2 Servlet执行…...

Oracle查询表空间大小

1 查询数据库中所有的表空间以及表空间所占空间的大小 SELECTtablespace_name,sum( bytes ) / 1024 / 1024 FROMdba_data_files GROUP BYtablespace_name; 2 Oracle查询表空间大小及每个表所占空间的大小 SELECTtablespace_name,file_id,file_name,round( bytes / ( 1024 …...

【SpringBoot】100、SpringBoot中使用自定义注解+AOP实现参数自动解密

在实际项目中,用户注册、登录、修改密码等操作,都涉及到参数传输安全问题。所以我们需要在前端对账户、密码等敏感信息加密传输,在后端接收到数据后能自动解密。 1、引入依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId...

Spring Boot面试题精选汇总

&#x1f91f;致敬读者 &#x1f7e9;感谢阅读&#x1f7e6;笑口常开&#x1f7ea;生日快乐⬛早点睡觉 &#x1f4d8;博主相关 &#x1f7e7;博主信息&#x1f7e8;博客首页&#x1f7eb;专栏推荐&#x1f7e5;活动信息 文章目录 Spring Boot面试题精选汇总⚙️ **一、核心概…...

稳定币的深度剖析与展望

一、引言 在当今数字化浪潮席卷全球的时代&#xff0c;加密货币作为一种新兴的金融现象&#xff0c;正以前所未有的速度改变着我们对传统货币和金融体系的认知。然而&#xff0c;加密货币市场的高度波动性却成为了其广泛应用和普及的一大障碍。在这样的背景下&#xff0c;稳定…...

JS设计模式(4):观察者模式

JS设计模式(4):观察者模式 一、引入 在开发中&#xff0c;我们经常会遇到这样的场景&#xff1a;一个对象的状态变化需要自动通知其他对象&#xff0c;比如&#xff1a; 电商平台中&#xff0c;商品库存变化时需要通知所有订阅该商品的用户&#xff1b;新闻网站中&#xff0…...

安宝特案例丨Vuzix AR智能眼镜集成专业软件,助力卢森堡医院药房转型,赢得辉瑞创新奖

在Vuzix M400 AR智能眼镜的助力下&#xff0c;卢森堡罗伯特舒曼医院&#xff08;the Robert Schuman Hospitals, HRS&#xff09;凭借在无菌制剂生产流程中引入增强现实技术&#xff08;AR&#xff09;创新项目&#xff0c;荣获了2024年6月7日由卢森堡医院药剂师协会&#xff0…...

uniapp 开发ios, xcode 提交app store connect 和 testflight内测

uniapp 中配置 配置manifest 文档&#xff1a;manifest.json 应用配置 | uni-app官网 hbuilderx中本地打包 下载IOS最新SDK 开发环境 | uni小程序SDK hbulderx 版本号&#xff1a;4.66 对应的sdk版本 4.66 两者必须一致 本地打包的资源导入到SDK 导入资源 | uni小程序SDK …...

打手机检测算法AI智能分析网关V4守护公共/工业/医疗等多场景安全应用

一、方案背景​ 在现代生产与生活场景中&#xff0c;如工厂高危作业区、医院手术室、公共场景等&#xff0c;人员违规打手机的行为潜藏着巨大风险。传统依靠人工巡查的监管方式&#xff0c;存在效率低、覆盖面不足、判断主观性强等问题&#xff0c;难以满足对人员打手机行为精…...

【UE5 C++】通过文件对话框获取选择文件的路径

目录 效果 步骤 源码 效果 步骤 1. 在“xxx.Build.cs”中添加需要使用的模块 &#xff0c;这里主要使用“DesktopPlatform”模块 2. 添加后闭UE编辑器&#xff0c;右键点击 .uproject 文件&#xff0c;选择 "Generate Visual Studio project files"&#xff0c;重…...

ui框架-文件列表展示

ui框架-文件列表展示 介绍 UI框架的文件列表展示组件&#xff0c;可以展示文件夹&#xff0c;支持列表展示和图标展示模式。组件提供了丰富的功能和可配置选项&#xff0c;适用于文件管理、文件上传等场景。 功能特性 支持列表模式和网格模式的切换展示支持文件和文件夹的层…...