Unity照片墙简易圆形交互效果总结

news/2024/5/16 17:01:13

还要很多可以优化的点地方,有兴趣的可以做
比如对象的销毁和生成可以做成对象池,走到最左边后再移动到最右边循环利用

分析过程文件,采用Blender,资源已上传,可以播放动画看效果,下面截个图:
在这里插入图片描述

视频效果如下:

anim

Untiy结构如下:
在这里插入图片描述
上面的ImageItem是我手动添加展示关系用的,默认就一个Target,PictureWall挂PictureWall脚本,ImageItem(预制体)挂ImageItemController 脚本即可

using UnityEngine;public class ImageItemController : MonoBehaviour
{public RectTransform target;public float speed = 10;[SerializeField]private float radiusScale = 1;public float horizontalOffset = 0;private RectTransform rect;private float radius = 0;private Vector2 originalPos = Vector2.zero;private bool isCheck = false;private bool isStartRotate = false;private Vector2 circleCenter;private float xDelta = 0;private float offset = 0;void Start(){rect = transform as RectTransform;rect.anchoredPosition = new Vector2(rect.anchoredPosition.x - horizontalOffset, rect.anchoredPosition.y);radius = target.rect.width * radiusScale;// * Random.Range(0.8f, 1); 半径可以在范围内随机}/* 1.现根据接触点计算出圆的路径:目标移动的位移,计算在圆的的位置,只需修改x即可,y保持不变* 2.计算出的位置x加上移动的距离,得出最总x的位置* 3.设置位置即可* 4.走远时的接触点:开始接触时的关于x对称位置  * 5.添加移动:平移原点和圆点即可*///移动void Update(){if (!isCheck){var dis = Vector2.Distance(target.anchoredPosition, rect.anchoredPosition);if (dis <= radius){isCheck = true;originalPos = rect.anchoredPosition;float y = Mathf.Abs(originalPos.y - target.anchoredPosition.y);float xToCircleCenter = Mathf.Sqrt(radius * radius - y * y);float x = originalPos.x - xToCircleCenter;circleCenter = new Vector2(x, target.anchoredPosition.y);isStartRotate = true;rect.SetSiblingIndex(transform.parent.childCount - 2);}}xDelta = Time.deltaTime * speed;rect.anchoredPosition = new Vector2(rect.anchoredPosition.x - xDelta, rect.anchoredPosition.y);if (isStartRotate){circleCenter.x -= xDelta;originalPos.x -= xDelta;float moveXDistance = target.anchoredPosition.x - circleCenter.x;float x = originalPos.x - circleCenter.x - moveXDistance;float y = Mathf.Sqrt(radius * radius - x * x);float maxY = radius;if (originalPos.y < circleCenter.y){y = -y;maxY = -radius;}Vector2 circlePoint = new Vector2(x, y);if (rect.anchoredPosition.x >= target.anchoredPosition.x){var v1 = circlePoint - (originalPos - circleCenter);var v2 = (originalPos - circleCenter) + new Vector2(0, maxY);v2.Normalize();offset = Vector2.Dot(v1, v2);}else{float tempX = originalPos.x - circleCenter.x;Vector2 originalPos2 = originalPos + 2 * new Vector2(-tempX, 0);var v1 = circlePoint - new Vector2(0, maxY);var v2 = originalPos2 - circleCenter + new Vector2(0, maxY);v2.Normalize();offset = -Vector2.Dot(v1, v2);}if (float.IsNaN(offset)){offset = 0;}x += moveXDistance + offset;Vector2 pos = circleCenter + new Vector2(x, y);rect.anchoredPosition = pos;if (target.anchoredPosition.x >= originalPos.x + originalPos.x - circleCenter.x){rect.anchoredPosition = originalPos;rect.SetAsFirstSibling();}else if (target.anchoredPosition.x <= circleCenter.x){rect.anchoredPosition = originalPos;rect.SetAsFirstSibling();}}if (rect.anchoredPosition.x < -rect.rect.width){Destroy(gameObject);}}
}
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
using Utility;public class PictureWall : MonoBehaviour
{[SerializeField]private GameObject prefab;private const float WIDTH = 3072;private const float HEIGHT = 1664;private int row = 6;private int column;private float intervalDistance = 20;[SerializeField]private float offset = 200;private float itemWidth;private float itemHeight;public float speed = 10;private float time = 0;[SerializeField]private RectTransform target;private string path = "/PictureWall/";private List<string> texturePaths;private int currentIndex = 0;private List<Texture2D> textureList;void Start(){textureList = new List<Texture2D>();path = Application.streamingAssetsPath + path;ReadImage();CalculateRowColumn();enabled = false;}private void ReadImage(){if (!Directory.Exists(path)){Directory.CreateDirectory(path);return;}texturePaths = new List<string>();var jpgs = Directory.GetFiles(path, "*.jpg");texturePaths.AddRange(jpgs);texturePaths.Reverse();if (texturePaths.Count > 100){for (int i = texturePaths.Count - 1; i == 100; i--){File.Delete(texturePaths[i]);texturePaths.RemoveAt(i);}}foreach (var filePath in texturePaths){UtilityLoadImage.I.LoadImage(filePath, tex =>{textureList.Add(tex);addNum++;if (addNum == texturePaths.Count){Spawn();}});}}float addNum = 0;private void Spawn(){float x = 0;float y = 0;for (int i = 0; i < row; i++){y = i * (itemHeight + intervalDistance);for (int j = 0; j < column; j++){x = j * (itemWidth + intervalDistance);if (i % 2 != 0){//x -= offset;}RectTransform rect = Instantiate(prefab, transform).transform as RectTransform;rect.pivot = new Vector2(0.5f, 0.5f);rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, itemWidth);rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, itemHeight);rect.anchoredPosition = new Vector2(x, -y) + new Vector2(rect.rect.width / 2, -rect.rect.height / 2);var controller = rect.GetComponent<ImageItemController>();controller.speed = speed;controller.target = target;if (i % 2 != 0){controller.horizontalOffset = offset;}SetTexture(rect);}}target.SetAsLastSibling();  enabled = true;}private void CalculateRowColumn(){itemHeight = (HEIGHT - (row - 1) * intervalDistance) / row;itemWidth = itemHeight * 16 / 9;//offset = itemWidth / 2;column = (int)(WIDTH / (itemWidth + intervalDistance)) + 3;time = itemWidth / speed;}bool isSpawned = false;private void Update(){if (!isSpawned && transform.childCount <= (column - 1) * row + 1){isSpawned = true;SpawnColumn();}}private void SpawnColumn(){float x = 0;float y = 0;for (int i = 0; i < row; i++){y = i * (itemHeight + intervalDistance);for (int j = 0; j < 1; j++){x = (column - 1) * (itemWidth + intervalDistance);RectTransform rect = Instantiate(prefab, transform).transform as RectTransform;rect.pivot = new Vector2(0.5f, 0.5f);rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, itemWidth);rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, itemHeight);rect.anchoredPosition = new Vector2(x, -y) + new Vector2(intervalDistance - Time.deltaTime * speed, -rect.rect.height / 2);var controller = rect.GetComponent<ImageItemController>();controller.speed = speed;controller.target = target;if (i % 2 != 0){controller.horizontalOffset = offset;}SetTexture(rect);}}target.SetAsLastSibling();StartCoroutine(Delay());}private void SetTexture(RectTransform rect){        rect.GetComponent<RawImage>().texture = textureList[currentIndex];currentIndex = (currentIndex + 1) % texturePaths.Count;}private IEnumerator Delay(){//yield return new WaitForSeconds(0.1f);yield return null;isSpawned = false;}
}
工具类
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;namespace Utility
{public class UtilityLoadImage{public class MonoHelper : MonoBehaviour { }public static UtilityLoadImage I;private static MonoHelper helper;static UtilityLoadImage(){var go = new GameObject("UtilityLoadImage");helper = go.AddComponent<MonoHelper>();UnityEngine.Object.DontDestroyOnLoad(go);I = new UtilityLoadImage();}private UtilityLoadImage() { }#region  inner methodprivate IEnumerator LoadTexture2D(string path, Action<Texture2D> callback){           //Debug.Log("path:" + path);           UnityWebRequest uwr = UnityWebRequestTexture.GetTexture(path);yield return uwr.SendWebRequest();if (uwr.downloadHandler.isDone){var tex = DownloadHandlerTexture.GetContent(uwr);callback?.Invoke(tex);}}private void LoadTexture2DByFile(string path, Action<Texture2D> callback){if (path.StartsWith("file://")){var bytes = File.ReadAllBytes(path);Texture2D tex = new Texture2D(1, 1);if (tex.LoadImage(bytes))callback?.Invoke(tex);}}private IEnumerator LoadByte(string path, Action<byte[]> callback){UnityWebRequest uwr = UnityWebRequest.Get(path);yield return uwr.SendWebRequest();if (uwr.downloadHandler.isDone){var data = uwr.downloadHandler.data;callback?.Invoke(data);}}private void DeleteFolder(string savedFolder, bool clearSavedPath, bool isRecursive = false){if (!Directory.Exists(savedFolder)){Debug.LogError("要删除的文件夹不存在!");return;}if (clearSavedPath){Directory.Delete(savedFolder, isRecursive);Directory.CreateDirectory(savedFolder);}}private byte[] Texture2DToByte(string path, Texture2D tex){byte[] data = null;int index = path.LastIndexOf('.');if (index != -1){string expandedName = path.Substring(index + 1);switch (expandedName){case "jpeg":case "jpg":data = tex.EncodeToJPG();break;case "png":data = tex.EncodeToPNG();break;default:Debug.Log("");break;}}else{Debug.Log("path is not correct!!!");}return data;}private IEnumerator LoadAudio(string path, string savedFolder, string fileName, Action<AudioClip> callback){UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(path, AudioType.MPEG);yield return request.SendWebRequest();if (request.downloadHandler.isDone){File.WriteAllBytes(savedFolder + "/" + fileName, request.downloadHandler.data);AudioClip clip = DownloadHandlerAudioClip.GetContent(request);callback?.Invoke(clip);}}private IEnumerator LoadAudio(string path, string savePath, Action<AudioClip> callback){UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(path, AudioType.MPEG);yield return request.SendWebRequest();if (request.downloadHandler.isDone){File.WriteAllBytes(savePath, request.downloadHandler.data);AudioClip clip = DownloadHandlerAudioClip.GetContent(request);callback?.Invoke(clip);}}private IEnumerator LoadAudio(string path, Action<AudioClip> callback){UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(path, AudioType.MPEG);yield return request.SendWebRequest();if (request.downloadHandler.isDone){AudioClip clip = DownloadHandlerAudioClip.GetContent(request);if (callback != null)callback(clip);elseDebug.Log("加载音频回调为null");}}#endregion#region load and download imagepublic void LoadImage(string path, Action<Texture2D> callback){helper.StartCoroutine(LoadTexture2D(path, callback));}public void LoadImageByFile(string path, Action<Texture2D> callback){LoadTexture2DByFile(path, callback);}public void LoadImages(string[] paths, Action<List<Texture2D>> callback){Debug.Log("start!!!!!");List<Texture2D> list = new List<Texture2D>();for (int i = 0; i < paths.Length; i++){LoadImage(paths[i], tex => list.Add(tex));}callback?.Invoke(list);Debug.Log("end!!!!!" + list.Count);}public void LoadImagesByFile(string[] paths, Action<List<Texture2D>> callback){List<Texture2D> list = new List<Texture2D>();for (int i = 0; i < paths.Length; i++){var data = File.ReadAllBytes(paths[i]);Texture2D tex = new Texture2D(1, 1);if (tex.LoadImage(data))list.Add(tex);}callback?.Invoke(list);}public void DownloadImageAndSave(string url, string savedFolder, string fileName, Action callback = null){helper.StartCoroutine(LoadTexture2D(url, tex =>{File.WriteAllBytes(savedFolder + "/" + fileName, Texture2DToByte(url, tex));callback?.Invoke();}));}public void DownloadImageAndSave(string url, string savePath, Action callback = null){helper.StartCoroutine(LoadTexture2D(url, tex =>{File.WriteAllBytes(savePath, Texture2DToByte(url, tex));callback?.Invoke();}));}public void DownloadImageAndSave_Texture2D(string url, string savedFolder, string fileName, Action<Texture2D> callback = null){helper.StartCoroutine(LoadTexture2D(url, tex =>{File.WriteAllBytes(savedFolder + "/" + fileName, Texture2DToByte(url, tex));callback?.Invoke(tex);}));}public void DownloadImageAndSave_Texture2D(string url, string savePath, Action<Texture2D> callback = null){helper.StartCoroutine(LoadTexture2D(url, tex =>{File.WriteAllBytes(savePath, Texture2DToByte(url, tex));callback?.Invoke(tex);}));}public void DownloadImageAndSave_FilePath(string url, string savedFolder, string fileName, Action<string> callback = null){helper.StartCoroutine(LoadTexture2D(url, tex =>{string path = savedFolder + "/" + fileName;File.WriteAllBytes(path, Texture2DToByte(url, tex));callback?.Invoke(path);}));}public void DownloadImageAndSave_FilePath(string url, string savePath, Action<string> callback = null){helper.StartCoroutine(LoadTexture2D(url, tex =>{File.WriteAllBytes(savePath, Texture2DToByte(url, tex));callback?.Invoke(savePath);}));}public void DownloadImagesAndSave(string[] urls, string savedFolder, string[] fileNames, Action completedCallback = null, bool deleteFolder = false, bool recursive = false){if (urls.Length != fileNames.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}DeleteFolder(savedFolder, deleteFolder, recursive);int completedNum = 0;for (int i = 0; i < urls.Length; i++){DownloadImageAndSave(urls[i], savedFolder, fileNames[i], () =>{++completedNum;if (completedNum == urls.Length){completedCallback?.Invoke();Debug.Log("所以文件下载完成!");}});}}public void DownloadImagesAndSave_Texture2DPaths(string[] urls, string savedFolder, string[] fileNames, Action<string[]> callback = null, bool deleteFolder = false, bool recursive = false){if (urls.Length != fileNames.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}DeleteFolder(savedFolder, deleteFolder, recursive);int completedNum = 0;string[] filePaths = new string[fileNames.Length];for (int i = 0; i < urls.Length; i++){DownloadImageAndSave_FilePath(urls[i], savedFolder, fileNames[i], path =>{filePaths[completedNum] = path;++completedNum;if (completedNum == urls.Length){callback?.Invoke(filePaths);Debug.Log("所以图片下载完成!");}});}}public void DownloadImagesAndSave_Texture2DPaths(string[] urls, string[] savePaths, Action<string[]> callback = null){if (urls.Length != savePaths.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}int completedNum = 0;string[] filePaths = new string[savePaths.Length];for (int i = 0; i < urls.Length; i++){DownloadImageAndSave_FilePath(urls[i], savePaths[i], path =>{filePaths[completedNum] = path;++completedNum;if (completedNum == urls.Length){callback?.Invoke(filePaths);Debug.Log("所以图片下载完成!");}});}}public void DownloadImagesAndSave_Texture2Ds(string[] urls, string savedFolder, string[] fileNames, Action<Texture2D[]> callback = null, bool deleteFolder = false, bool recursive = false){if (urls.Length != fileNames.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}DeleteFolder(savedFolder, deleteFolder, recursive);int completedNum = 0;Texture2D[] textures = new Texture2D[fileNames.Length];for (int i = 0; i < urls.Length; i++){DownloadImageAndSave_Texture2D(urls[i], savedFolder, fileNames[i], tex =>{textures[completedNum] = tex;++completedNum;if (completedNum == urls.Length){callback?.Invoke(textures);Debug.Log("所以图片下载完成!");}});}}public void DownloadImagesAndSave_Texture2Ds(string[] urls, string[] savePaths, Action<Texture2D[]> callback = null){if (urls.Length != savePaths.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}int completedNum = 0;Texture2D[] textures = new Texture2D[savePaths.Length];for (int i = 0; i < urls.Length; i++){DownloadImageAndSave_Texture2D(urls[i], savePaths[i], tex =>{textures[completedNum] = tex;++completedNum;if (completedNum == urls.Length){callback?.Invoke(textures);Debug.Log("所以图片下载完成!");}});}}#endregion#region download filepublic void DownloadFileAndSave(string url, string savedFolder, string fileName, Action callback = null){helper.StartCoroutine(LoadByte(url, data =>{File.WriteAllBytes(savedFolder + "/" + fileName, data);callback?.Invoke();}));}public void DownloadFileAndSave(string url, string savePath, Action callback = null){helper.StartCoroutine(LoadByte(url, data =>{File.WriteAllBytes(savePath, data);callback?.Invoke();}));}public void DownloadFileAndSave_FilePath(string url, string savedFolder, string fileName, Action<string> callback = null){helper.StartCoroutine(LoadByte(url, data =>{string path = savedFolder + "/" + fileName;File.WriteAllBytes(path, data);callback?.Invoke(path);}));}public void DownloadFileAndSave_FilePath(string url, string savePath, Action<string> callback = null){helper.StartCoroutine(LoadByte(url, data =>{File.WriteAllBytes(savePath, data);callback?.Invoke(savePath);}));}public void DownloadFileAndSave_FileData(string url, string savedFolder, string fileName, Action<byte[]> callback = null){helper.StartCoroutine(LoadByte(url, data =>{string path = savedFolder + "/" + fileName;File.WriteAllBytes(path, data);callback?.Invoke(data);}));}public void DownloadFileAndSave_FileData(string url, string savePath, Action<byte[]> callback = null){helper.StartCoroutine(LoadByte(url, data =>{File.WriteAllBytes(savePath, data);callback?.Invoke(data);}));}public void DownloadFilesAndSave(string[] urls, string savedFolder, string[] fileNames, Action completedCallback = null, bool deleteFolder = false, bool recursive = false){if (urls.Length != fileNames.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}DeleteFolder(savedFolder, deleteFolder, recursive);int completedNum = 0;for (int i = 0; i < urls.Length; i++){DownloadFileAndSave(urls[i], savedFolder, fileNames[i], () =>{++completedNum;if (completedNum == fileNames.Length){completedCallback?.Invoke();}});}}public void DownloadFilesAndSave(string[] urls, string[] savePath, Action callback = null){if (urls.Length != savePath.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}int completedNum = 0;for (int i = 0; i < urls.Length; i++){DownloadFileAndSave(urls[i], savePath[i], () =>{++completedNum;if (completedNum == savePath.Length){callback?.Invoke();}});}}public void DownloadFilesAndSave_FilePaths(string[] urls, string savedFolder, string[] fileNames, Action<string[]> completedCallback = null, bool deleteFolder = false, bool recursive = false){if (urls.Length != fileNames.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}DeleteFolder(savedFolder, deleteFolder, recursive);int completedNum = 0;string[] filePaths = new string[fileNames.Length];for (int i = 0; i < urls.Length; i++){DownloadFileAndSave_FilePath(urls[i], savedFolder, fileNames[i], path =>{filePaths[completedNum] = path;++completedNum;if (completedNum == fileNames.Length){completedCallback?.Invoke(filePaths);}});}}public void DownloadFilesAndSave_FilePaths(string[] urls, string[] savePath, Action<string[]> completedCallback = null){if (urls.Length != savePath.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}int completedNum = 0;string[] filePaths = new string[savePath.Length];for (int i = 0; i < urls.Length; i++){DownloadFileAndSave_FilePath(urls[i], savePath[i], path =>{filePaths[completedNum] = path;++completedNum;if (completedNum == savePath.Length){completedCallback?.Invoke(filePaths);}});}}public void DownloadFilesAndSave_FileDatas(string[] urls, string savedFolder, string[] fileNames, Action<List<byte[]>> completedCallback = null, bool deleteFolder = false, bool recursive = false){if (urls.Length != fileNames.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}DeleteFolder(savedFolder, deleteFolder, recursive);int completedNum = 0;List<byte[]> allDatas = new List<byte[]>(fileNames.Length);for (int i = 0; i < urls.Length; i++){DownloadFileAndSave_FileData(urls[i], savedFolder, fileNames[i], data =>{allDatas.Add(data);++completedNum;if (completedNum == fileNames.Length){completedCallback?.Invoke(allDatas);}});}}public void DownloadFilesAndSave_FileDatas(string[] urls, string[] savePath, Action<List<byte[]>> completedCallback = null){if (urls.Length != savePath.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}int completedNum = 0;List<byte[]> allDatas = new List<byte[]>(savePath.Length);for (int i = 0; i < urls.Length; i++){DownloadFileAndSave_FileData(urls[i], savePath[i], data =>{allDatas.Add(data);++completedNum;if (completedNum == savePath.Length){completedCallback?.Invoke(allDatas);}});}}#endregion#region download audiopublic void DownloadAudioAndSave_FileData(string url, string savedFolder, string fileName, Action<AudioClip> callback = null){helper.StartCoroutine(LoadAudio(url, savedFolder, fileName, callback));}public void DownloadAudioAndSave_FileData(string url, string savePath, Action<AudioClip> callback = null){helper.StartCoroutine(LoadAudio(url, savePath, callback));}public void LoadAudioClip(string url, Action<AudioClip> callback = null){helper.StartCoroutine(LoadAudio(url, callback));}#endregion}
}

http://www.mrgr.cn/p/34723082

相关文章

VMware vSAN OSA存储策略 - 基于虚拟机的分布式对象存储

简介 博客&#xff1a;https://songxwn.com/ 存储策略 (Storage Policy) 是管理员定义的一组规则&#xff0c;这组规则定义了数据对象在 vSAN 存储上是如何保存的&#xff0c;存储策略定义了数据存储的可靠性、访问性能等特性。vSAN 提供了基于存储策略的存储管理 SPBM (Stor…

52、快速拆分数据【ctrl+e】

首先列出一个表,然后写上第一行的【姓名】和【员工工号】 鼠标点击【姓名】,然后按【ctrl+e】, 鼠标点击【员工工号】,然后按【ctrl+e】, 表格就能自动罗列出分离的数据

51、快速求和 【alt+=】

列了表格之后,然后框中除红色线以外的数字,按【alt+=】就可以自动求和(横列和竖列), 求和的实际就是运用公式:=SUM(B2:D2)

【JMeter入门】—— JMeter介绍

1、什么是JMeter Apache JMeter是Apache组织开发的基于Java的压力测试工具&#xff0c;用于对软件做压力测试。它最初被设计用于Web应用测试&#xff0c;但后来扩展到其他测试领域。 &#xff08;Apache JMeter是100%纯JAVA桌面应用程序&#xff09;Apache JMeter可以用于对静…

CorelDraw (CDR) VBA 实现导出贴图坐标

创作上位机动画时, 喜欢用Corel做画面设计,毕竟不管是亚控还是力控还是wincc,画图都太难受了. 贴图动画要贴准的话, 最好用坐标精确对齐. 所以写了这段代码, 用来把Corel中的坐标写入文本文件, 做上位机画面时, 就可以使用这些坐标进行贴图了. 上代码1 Sub Macro1()2 Dim 元…

excel中批量插入分页符

excel中批量插入分页符&#xff0c;实现按班级打印学生名单。 1、把学生按照学号、班级排序好。 2、选择班级一列&#xff0c;点击数据-分类汇总。汇总方式选择计数&#xff0c;最后三个全部勾选。汇总结果一定要显示在数据的下发&#xff0c;如果显示在上方&#xff0c;后期…

Python图像处理——计算机视觉中常用的图像预处理

概述 在计算机视觉项目中&#xff0c;使用样本时经常会遇到图像样本不统一的问题&#xff0c;比如图像质量&#xff0c;并非所有的图像都具有相同的质量水平。在开始训练模型或运行算法之前&#xff0c;通常需要对图像进行预处理&#xff0c;以确保获得最佳的结果。图像预处理…

目标检测的相关模型图:YOLO系列和RCNN系列

目标检测的相关模型图&#xff1a;YOLO系列和RCNN系列 前言YOLO系列的图展示YOLOpassthroughYOLO2YOLO3YOLO4YOLO5 RCNN系列的图展示有关目标检测发展的 前言 最近好像大家也都在写毕业论文&#xff0c;前段时间跟朋友聊天&#xff0c;突然想起自己之前写画了一些关于YOLO、Fa…

镜视界 | DevSecOps CI/CD 管道中数字供应链安全的集成策略

目录 前言 数字供应链&#xff08;DSC&#xff09;的定义 数字供应链安全的重点内容和风险因素 CI/CD管道的安全目标和可信实体 将数字供应链安全集成到CI/CD管道中 结语 本文字数&#xff1a;7715&#xff0c;阅读时长&#xff1a;19分钟 1.前言 在敏捷开发的模式下&…

Upload Files

Upload Files的时候 文件超过64k 是会以文件的形式存到windows的temp文件夹的 当iis没有temp文件夹的写入权限 上传就全失败了,程序都捕获不到错误用form-data上传才会有的问题,用文件流的话 应该就没有这个问题了单个文件 小于64k的话 是会在内存中的超过64k 服务器的处理 …

数据库---PDO

以pikachu数据库为例&#xff0c;数据库名&#xff1a; pikachu 1.连接数据库 <?php $dsn mysql:hostlocalhost; port3306; dbnamepikachu; // 这里的空格比较敏感 $username root; $password root; try { $pdo new PDO($dsn, $username, $password); var_dump($pdo)…

计算机网络-网络文件共享协议

前言 在计算机网络中,我们经常会遇到在不同计算机网络系统之间如何共享和访问文件的场景,并且在实际项目中有这样的需求,在Linux中需要动态的mount文件,需要选择合适的网络文件共享协议以满足并发,吞吐量等需求。这就涉及今天要讲的网络文件共享协议SMB和NFS。 SMB vs NFS…

火车头通过关键词采集文章的原理

随着互联网信息的爆炸式增长&#xff0c;网站管理员和内容创作者需要不断更新和发布新的文章&#xff0c;以吸引更多的用户和提升网站的排名。而火车头作为一款智能文章采集工具&#xff0c;在这一过程中发挥着重要作用。本文将探讨火车头如何通过关键词采集文章&#xff0c;以…

UE5 C++ 3D血条 响应人物受伤 案例

一.3Dwidget 1.创建C Userwidget的 MyHealthWidget&#xff0c;声明当前血量和最大血量 UCLASS() class PRACTICEC_API UMyHealthWidget : public UUserWidget {GENERATED_BODY() public:UPROPERTY(EditAnywhere,BlueprintReadWrite,Category "MyWidget")float C…

linux离线安装jenkins及使用教程

本教程采用jenkins.war的方式离线安装部署&#xff0c;在线下载的方式会遇到诸多问题&#xff0c;不宜采用 一、下载地址 地址&#xff1a;Jenkins download and deployment 下载最新的长期支持版 由于jenkins使用java开发的&#xff0c;所以需要安装的linux服务器装有jdk环…

WordPress Git主题 响应式CMS主题模板

分享的是新版本&#xff0c;旧版本少了很多功能&#xff0c;尤其在新版支持自动更新后&#xff0c;该主题可以用来搭建个人博客&#xff0c;素材下载网站&#xff0c;图片站等 主题特点 兼容 IE9、谷歌 Chrome 、火狐 Firefox 等主流浏览器 扁平化的设计加响应式布局&#x…

冲刺 NOIP 400pts + 之神仙专题

冲刺专题之 \(DP\) \(T_A\) Helping People $$codeforces$$ 题意给定一个长为 \(n\) 序列 \(A\) , 其中有 \(q\) 个区间 \([l , r]\) 定义为 \(B_i\) , 对于每一个区间 , 其有 \(P_i\) 的概率使 \(A\) 序列从 \(l\) 到 \(r\) 之间的数增加 \(1\) . 问最后整个区间的最大值的期望…

Vue 04 Vue 中的 Ajax、slot 插槽

Vue学习 Vue 0401 Vue中的Ajax服务器准备axios使用跨域问题解决Vue-CLI 配置代理1Vue-CLI 配置代理2案例: 用户搜索vue-resource 02 slot插槽默认插槽具名插槽作用域插槽slot总结 Vue 04 B站 Vue全家桶&#xff08;BV1Zy4y1K7SH&#xff09; 学习笔记 Vue 中的 ajax 01 Vue中的…

基于svelte webpack开发umd格式的npm包

原文链接: https://www.cnblogs.com/yalong/p/18101609 背景: 平常会接触到vue、react、jquery项目,项目中有一些公共组件其实是可以复用的,但是在vue项目中封装好的组件,在react中又不能用; 于是想找个方法,实现一次开发,多框架复用,调研发现svelte正好符合这个要求, …