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

全景图 与 6面图转换

目录

全景图转6面图:

6面图转全景图


全景图转6面图:

https://github.com/springcheese/panoramic_to_cubemap_generation


# Necessary Imports
import math
import argparse
import numpy as np
from PIL import Image# Dictionary for CUBEMAP FACES
CUBEMAP_FACES = {'back': 0, 'left': 1, 'front': 2, 'right': 3, 'top' : 4, 'bottom' : 5 }# Dimensions of the input image
INPUT_WIDTH = 2048
INPUT_HEIGHT = 1024def output_image_to_xyz(i, j, cube_face_id, edge_length):"""Get x,y,z coordinates from the output image pixel coordinates (i,j) taking into account different faces of the cube map:param i: Image row Pixel Coordinate:param j: Image column Pixel Coordinate:param cube_face_id: The face Id of the Cube Map:param edge_length: The size of the face:return: Tuple (x,y,z)"""a = 2.0 * float(i) / edge_lengthb = 2.0 * float(j) / edge_lengthif cube_face_id == CUBEMAP_FACES['back']:(x,y,z) = (-1.0, 1.0 - a, 1.0 - b)elif cube_face_id == CUBEMAP_FACES['left']:(x,y,z) = (a - 1.0, -1.0, 1.0 - b)elif cube_face_id == CUBEMAP_FACES['front']:(x,y,z) = (1.0, a - 1.0, 1.0 - b)elif cube_face_id == CUBEMAP_FACES['right']:(x,y,z) = (1.0 - a, 1.0, 1.0 - b)elif cube_face_id == CUBEMAP_FACES['top']:(x,y,z) = (b - 1.0, a - 1.0, 1.0)elif cube_face_id == CUBEMAP_FACES['bottom']:(x,y,z) = (1.0 - b, a - 1.0, -1.0)return (x, y, z)# -------------------------------------------------------
def generate_cubemap_face(input_image, output_image, cube_face_id):"""Generate a face of the Cube Map from the Input Image:param input_image: Input Image:param output_image: Output Image Handle as the blank image:param cube_face_id: Face ID to construct:return:Implicit in the Output Image"""input_size = input_image.sizeoutput_size = output_image.sizeinput_pixels = input_image.load()output_pixels = output_image.load()edge_length = output_size[0]for x_out in range(edge_length):for y_out in range(edge_length):(x,y,z) = output_image_to_xyz(x_out, y_out, cube_face_id, edge_length)theta = math.atan2(y,x)r = math.hypot(x,y)phi = math.atan2(z,r)# Source Image Coordinatesuf = 0.5 * input_size[0] * (theta + math.pi) / math.pivf = 0.5 * input_size[0] * (math.pi/2 - phi) / math.pi# Bilinear Interpolation amongst the four surrounding pixelsui = math.floor(uf)  # bottom leftvi = math.floor(vf)u2 = ui+1            # top rightv2 = vi+1mu = uf-uinu = vf-vi# Pixel values of four cornersA = input_pixels[ui % input_size[0], np.clip(vi, 0, input_size[1]-1)]B = input_pixels[u2 % input_size[0], np.clip(vi, 0, input_size[1]-1)]C = input_pixels[ui % input_size[0], np.clip(v2, 0, input_size[1]-1)]D = input_pixels[u2 % input_size[0], np.clip(v2, 0, input_size[1]-1)]# interpolate(r,g,b) = (A[0]*(1-mu)*(1-nu) + B[0]*(mu)*(1-nu) + C[0]*(1-mu)*nu+D[0]*mu*nu,A[1]*(1-mu)*(1-nu) + B[1]*(mu)*(1-nu) + C[1]*(1-mu)*nu+D[1]*mu*nu,A[2]*(1-mu)*(1-nu) + B[2]*(mu)*(1-nu) + C[2]*(1-mu)*nu+D[2]*mu*nu )output_pixels[x_out, y_out] = (int(round(r)), int(round(g)), int(round(b)))# -------------------------------------------------------
def generate_cubemap_outputs(input_image_path):"""Generate the cubemap faces output from the input image path(Directly save the output in the same path with suffixes for cubemap faces):param input_image_path: Input Image:return:Implicit in the Output Image Saving Process"""print ('---------------------------------------------------------------------------')print ('Generating Cubemap Faces  ------------ ' + input_image_path)# Read the input imageinput_image = Image.open(input_image_path)input_image = input_image.resize((int(INPUT_WIDTH), int(INPUT_HEIGHT)))input_size = input_image.size# Define the edge length - This will be the width and height of each cubemap faceedge_length = input_size[0] // 4# Generate cubemap for the left faceout_image = Image.new("RGB", (edge_length, edge_length), "black")generate_cubemap_face(input_image, out_image, CUBEMAP_FACES['left'])out_image.save(input_image_path[0:-4] + '_cubemap_left.png')print ('LEFT face done')# Generate cubemap for the front faceout_image = Image.new("RGB", (edge_length, edge_length), "black")generate_cubemap_face(input_image, out_image, CUBEMAP_FACES['front'])out_image.save(input_image_path[0:-4] + '_cubemap_front.png')print ('FRONT face done')# Generate cubemap for the right faceout_image = Image.new("RGB", (edge_length, edge_length), "black")generate_cubemap_face(input_image, out_image, CUBEMAP_FACES['right'])out_image.save(input_image_path[0:-4] + '_cubemap_right.png')print ('RIGHT face done')# Generate cubemap for the back faceout_image = Image.new("RGB", (edge_length, edge_length), "black")generate_cubemap_face(input_image, out_image, CUBEMAP_FACES['back'])out_image.save(input_image_path[0:-4] + '_cubemap_back.png')print ('BACK face done')# Generate cubemap for the top faceout_image = Image.new("RGB", (edge_length, edge_length), "black")generate_cubemap_face(input_image, out_image, CUBEMAP_FACES['top'])out_image.save(input_image_path[0:-4] + '_cubemap_top.png')print ('TOP face done')# Generate cubemap for the bottom faceout_image = Image.new("RGB", (edge_length, edge_length), "black")generate_cubemap_face(input_image, out_image, CUBEMAP_FACES['bottom'])out_image.save(input_image_path[0:-4] + '_cubemap_bottom.png')print ('BOTTOM face done')print ('---------------------------------------------------------------------------')def main():parser = argparse.ArgumentParser()parser.add_argument("--input", help = "Enter the path of the input photosphere image (Resizes to INPUT_WIDTH x INPUT_HEIGHT for speed)",type=str, default='')args = parser.parse_args()input_image_path = r"D:\360极速浏览器X下载\517c9510-c456-481d-aaa8-78e6a7c2098b.png"input_image_path = r"E:\project\jijia\angle_360\demo\ComfyUI_00041_.png"input_image_path = r"E:\project\jijia\angle_360\demo\quan\ComfyUI_00043_.png"generate_cubemap_outputs(input_image_path)if __name__ == "__main__":main()

6面图转全景图

GitHub - eddyteddy3/CubeMap-To-Panorama: This code will transform 6-cubemap images to panorama using Py


import os
import numpy as np
from PIL import Image
from scipy.ndimage import map_coordinates# ---------- Image Utility ----------"""-> 6-images"""def image_list(images):assert len(images) == 6image_np_array = []for image in images:image_np_array.append(np.array(image))concatenated_image = np.concatenate(image_np_array, axis=1)# horizontal to diceassert concatenated_image.shape[0] * 6 == concatenated_image.shape[1]w = concatenated_image.shape[0]cube_dice = np.zeros((w * 3, w * 4, concatenated_image.shape[2]), dtype=concatenated_image.dtype)# cube_list = cube_h2list(concatenated_image)cube_list = np.split(concatenated_image, 6, axis=1)# Order: F R B L U Dsxy = [(1, 1), (2, 1), (3, 1), (0, 1), (1, 0), (1, 2)]for i, (sx, sy) in enumerate(sxy):face = cube_list[i]if i in [1, 2]:face = np.flip(face, axis=1)if i == 4:face = np.flip(face, axis=0)cube_dice[sy*w:(sy+1)*w, sx*w:(sx+1)*w] = face# dice to horizontalw = cube_dice.shape[0] // 3assert cube_dice.shape[0] == w * 3 and cube_dice.shape[1] == w * 4cube_h = np.zeros((w, w * 6, cube_dice.shape[2]), dtype=cube_dice.dtype)# Order: F R B L U Dsxy = [(1, 1), (2, 1), (3, 1), (0, 1), (1, 0), (1, 2)]for i, (sx, sy) in enumerate(sxy):face = cube_dice[sy*w:(sy+1)*w, sx*w:(sx+1)*w]# if i in [1, 2]:#     face = np.flip(face, axis=1)# if i == 4:#     face = np.flip(face, axis=0)cube_h[:, i*w:(i+1)*w] = facefixed_horizontal_images = cube_hreturn fixed_horizontal_images# -------------- Main Logic --------------"""generates the grid of u,v coordinates from 
u = -pi to pi 
v = pi/2 to -pi/2Mathematical notation. You can relate it with Longitude and Latitudeu ∈ [−π,π] ,v ∈ [ π/2, - π/2]"""def equirect_uvgrid(h, w):u = np.linspace(-np.pi, np.pi, num=w, dtype=np.float32)v = np.linspace(np.pi, -np.pi, num=h, dtype=np.float32) / 2return np.stack(np.meshgrid(u, v), axis=-1)"""creates a mapping for cube imagessuch that it represents which cube map maps to which equirectangle projection.
also determines the boundaries"""def equirect_facetype(h, w):'''0F 1R 2B 3L 4U 5D'''tp = np.roll(np.arange(4).repeat(w // 4)[None, :].repeat(h, 0), 3 * w // 8, 1)# Prepare ceil maskmask = np.zeros((h, w // 4), bool)idx = np.linspace(-np.pi, np.pi, w // 4) / 4idx = h // 2 - np.round(np.arctan(np.cos(idx)) * h / np.pi).astype(int)for i, j in enumerate(idx):mask[:j, i] = 1"""{x, y, z}-X        +x{-------|-------}"""mask = np.roll(np.concatenate([mask] * 4, 1), 3 * w // 8, 1)tp[mask] = 4tp[np.flip(mask, 0)] = 5return tp.astype(np.int32)"""applies the transformation to spherical coordinates, we acquired previously.
The padding is to handle the edges."""def sample_cubefaces(cube_faces, tp, coor_y, coor_x, order):cube_faces = cube_faces.copy()cube_faces[1] = np.flip(cube_faces[1], 1)cube_faces[2] = np.flip(cube_faces[2], 1)cube_faces[4] = np.flip(cube_faces[4], 0)# Pad up downpad_ud = np.zeros((6, 2, cube_faces.shape[2]))pad_ud[0, 0] = cube_faces[5, 0, :]pad_ud[0, 1] = cube_faces[4, -1, :]pad_ud[1, 0] = cube_faces[5, :, -1]pad_ud[1, 1] = cube_faces[4, ::-1, -1]pad_ud[2, 0] = cube_faces[5, -1, ::-1]pad_ud[2, 1] = cube_faces[4, 0, ::-1]pad_ud[3, 0] = cube_faces[5, ::-1, 0]pad_ud[3, 1] = cube_faces[4, :, 0]pad_ud[4, 0] = cube_faces[0, 0, :]pad_ud[4, 1] = cube_faces[2, 0, ::-1]pad_ud[5, 0] = cube_faces[2, -1, ::-1]pad_ud[5, 1] = cube_faces[0, -1, :]cube_faces = np.concatenate([cube_faces, pad_ud], 1)# Pad left rightpad_lr = np.zeros((6, cube_faces.shape[1], 2))pad_lr[0, :, 0] = cube_faces[1, :, 0]pad_lr[0, :, 1] = cube_faces[3, :, -1]pad_lr[1, :, 0] = cube_faces[2, :, 0]pad_lr[1, :, 1] = cube_faces[0, :, -1]pad_lr[2, :, 0] = cube_faces[3, :, 0]pad_lr[2, :, 1] = cube_faces[1, :, -1]pad_lr[3, :, 0] = cube_faces[0, :, 0]pad_lr[3, :, 1] = cube_faces[2, :, -1]pad_lr[4, 1:-1, 0] = cube_faces[1, 0, ::-1]pad_lr[4, 1:-1, 1] = cube_faces[3, 0, :]pad_lr[5, 1:-1, 0] = cube_faces[1, -2, :]pad_lr[5, 1:-1, 1] = cube_faces[3, -2, ::-1]cube_faces = np.concatenate([cube_faces, pad_lr], 2)return map_coordinates(cube_faces, [tp, coor_y, coor_x], order=order, mode='wrap')"""Main Function to convert the cube maps to equirectangle image- Calculates the U,V with helper function
- Creates Mapping
- Normalize the coordinates
- Reconstruction of image"""def cube_to_equirectanlge(cubemap, h, w, mode='bilinear'):if mode == 'bilinear':order = 1elif mode == 'nearest':order = 0else:raise NotImplementedError('unknown mode')assert len(cubemap.shape) == 3assert cubemap.shape[0] * 6 == cubemap.shape[1]assert w % 8 == 0face_w = cubemap.shape[0]uv = equirect_uvgrid(h, w)u, v = np.split(uv, 2, axis=-1)u = u[..., 0]v = v[..., 0]cube_faces = np.stack(np.split(cubemap, 6, 1), 0)# Get face id to each pixel: 0F 1R 2B 3L 4U 5Dtp = equirect_facetype(h, w)coor_x = np.zeros((h, w))coor_y = np.zeros((h, w))for i in range(4):mask = (tp == i)coor_x[mask] = 0.5 * np.tan(u[mask] - np.pi * i / 2)coor_y[mask] = -0.5 * np.tan(v[mask]) / np.cos(u[mask] - np.pi * i / 2)mask = (tp == 4)c = 0.5 * np.tan(np.pi / 2 - v[mask])coor_x[mask] = c * np.sin(u[mask])coor_y[mask] = c * np.cos(u[mask])mask = (tp == 5)c = 0.5 * np.tan(np.pi / 2 - np.abs(v[mask]))coor_x[mask] = c * np.sin(u[mask])coor_y[mask] = -c * np.cos(u[mask])# Final renormalizecoor_x = (np.clip(coor_x, -0.5, 0.5) + 0.5) * face_wcoor_y = (np.clip(coor_y, -0.5, 0.5) + 0.5) * face_wequirec = np.stack([sample_cubefaces(cube_faces[..., i], tp, coor_y, coor_x, order=order)for i in range(cube_faces.shape[3])], axis=-1)return equirec# ------- Load Images ------fixed_image = image_list([Image.open('front.jpeg'),  # FImage.open('right.jpeg'),  # RImage.open('back.jpeg'),   # BImage.open('left.jpeg'),   # LImage.open('up.jpeg'),     # UImage.open('down.jpeg')    # D]
)pano_image = cube_to_equirectanlge(fixed_image, 1024, 1280, mode='nearest')# img = Image.fromarray(pano_image.astype(np.uint8), 'RGB')# img = Image.fromarray(fixed_image, 'RGB')
# img.show()def generate_folder_info(root_folder):folder_info = []for subdir, _, files in os.walk(root_folder):image_files = [f for f in files if f.lower().endswith('jpg')]if len(image_files) == 6:relative_path = os.path.relpath(subdir, root_folder)parts = relative_path.split(os.sep)# print("parts ", parts)if len(parts) > 2:level1 = parts[0]level2 = parts[1]level3 = parts[2]folder_info.append({"level1": level1,"level2": level2,"level3": level3})elif len(parts) == 2:level1 = parts[0]level2 = parts[1]folder_info.append({"level1": level1, "level2": level2})return folder_info# Step 1: Read all the directories {Level1: {id of classified}, level2: 'roomName'}
folder_infos = generate_folder_info("image_set")#Step 
for folder_info in folder_infos:level1 = folder_info['level1']level2 = folder_info['level2']level_heirarchy = f"{level1}/{level2}"pathToImageFolder = f"image_set/{level_heirarchy}"if 'level3' in folder_info:level3 = folder_info['level3']print("more than 3 levels", f"image_set/{level_heirarchy}/{level3}")pathToImageFolder = f"image_set/{level_heirarchy}/{level3}""""4 x 2pano_width = 1024 * 4 {pano_f.width}pano_height = 1024 * 2 {pano_f.height}actual_size = 4096 x 2048"""print("path: ", pathToImageFolder)temp_image = np.array(Image.open(f"{pathToImageFolder}/pano_f.jpg"))fixed_image = image_list([Image.open(f"{pathToImageFolder}/pano_f.jpg"), #Image.open('front.jpeg'),  # FImage.open(f"{pathToImageFolder}/pano_r.jpg"), #Image.open('right.jpeg'),  # RImage.open(f"{pathToImageFolder}/pano_b.jpg"), #Image.open('back.jpeg'),   # BImage.open(f"{pathToImageFolder}/pano_l.jpg"), #Image.open('left.jpeg'),   # LImage.open(f"{pathToImageFolder}/pano_u.jpg"), #Image.open('up.jpeg'),     # UImage.open(f"{pathToImageFolder}/pano_d.jpg") #Image.open('down.jpeg')    # D])fixed_width = temp_image.shape[1] * 4fixed_height = temp_image.shape[0] * 2pano_image = cube_to_equirectanlge(fixed_image, fixed_height, fixed_width, mode='nearest')img = Image.fromarray(pano_image.astype(np.uint8), 'RGB')print("sucking it bitch!")target = f"panorama_images/{level1}/"if not os.path.exists(target):os.makedirs(target)img.save(f"{target}/{level2}.jpg")print("sucked it bitch!")"""{x, y} STITCHED IMAGE -> Sphere {U,V} {Longitude & Latitude}folder_info -> [list folders] -> [6 images]image_set/{id}/room{something}/nameOfImage.jpg"""""""6 - cube image to Pano: cubemap-to-pano[6 cube maps] -> image_list -> one_stiched_image (NOT PANO)
one_stiched_image -> cube_to_equirectanlge -> Panorama Imagescript to scrap images: scrap-to-CubeMap
(some-very-smart-function) -> [6-cube-map-image]Proposal 1:
scrap-to-CubeMap -> [6-set-images] -> cubemap-to-pano -> Panorama ImageProposal 2: (STATIC & LOCAL) (WE ARE MOVING FORWRAD WITH THIS)
Aleady downloaded pictures
[DIRECTORY] -> [List of folders] -> [nested list of each classifieds] -> [nested list of each room] -> [6-cube-map] -> cubemap-to-pano -> Panorama ImageProposal 3: (Scrapping Dynamic) (BACKEND SIDE)
scrap-to-CubeMap -> [6-set-images] -> cubemap-to-pano -> Panorama Image"""

相关文章:

全景图 与 6面图转换

目录 全景图转6面图: 6面图转全景图 全景图转6面图: https://github.com/springcheese/panoramic_to_cubemap_generation # Necessary Imports import math import argparse import numpy as np from PIL import Image# Dictionary for CUBEMAP FACES…...

深入浅出:PHP 文件操作

文章目录 引言文件的基本操作打开文件读取文件逐行读取读取整个文件 写入文件追加写入覆盖写入 关闭文件 文件和目录的管理检查文件或目录是否存在创建和删除文件创建和删除目录复制和移动文件 处理文件权限设置文件权限获取文件权限 处理文件属性获取文件大小获取文件最后修改…...

116. UE5 GAS RPG 实现击杀掉落战利品功能

这一篇,我们实现敌人被击败后,掉落战利品的功能。首先,我们将创建一个新的结构体,用于定义掉落体的内容,方便我们设置掉落物。然后,我们实现敌人死亡时的掉落函数,并在蓝图里实现对应的逻辑&…...

【批处理脚本】更改Windows系统中的 hosts 解析文件

概述 作用 修改 Windows 系统中的 hosts 文件,可以实现 插入 或 删除 条目。该脚本允许用户以管理员权限执行,将特定的域名解析到指定的 IP 地址 应用场景 非常适用于需要频繁或批量修改 hosts 文件的场景: 屏蔽网站、域名重定向、DNS 污染防…...

fastDFS

docker 部署fastDFS docker pull delron/fastdfs docker-compose.yml version: 3services:fastdfs_tracker:image: delron/fastdfs:latestcontainer_name: trackerhostname: trackernetwork_mode: hostports:- "22122:22122"volumes:- ./data/tracker:/var/fdfsco…...

【Linux】存储

声明:以下内容均来学习自《Linux就该这么学》一书 Linux系统中的一切文件都是从“根(/)”目录开始的,并按照文件系统层次化标准(FHS)采用树形结构来存放文件,以及定义了常见目录的用途。此外,Linux系统中的…...

hadoop单机安装

步骤 1:安装 Java 安装 OpenJDK bash sudo yum install -y java-1.8.0-openjdk 验证 Java 安装 bash java -version 输出类似以下内容表示成功: arduino openjdk version “1.8.0_xxx” 步骤 2:下载 Hadoop 下载 Hadoop 安装包 前往 Hadoop 官方下载页面,获取最新稳…...

产品批量分类设置——未来之窗行业应用跨平台架构

一、批量统计分类 提高效率 节省时间:当商品数量庞大时,手动逐个修改商品分类是一项极其耗时的任务。例如,一个电商平台有数千种商品,如果手动操作,可能需要花费数天甚至数周的时间来完成分类转移。而批量设置功能可以…...

2024年中国各省份碳相关投资分析:区域差异与未来趋势

随着中国“双碳”目标的推进,各省份的碳相关投资逐渐成为推动绿色经济转型的关键力量。2024年,各地的双碳项目进入了快速发展阶段,尤其是在清洁能源、绿色技术和碳捕集领域。本文将分析中国各省份在碳减排、碳中和目标实现过程中的投资重点和…...

【六足机器人】03步态算法

温馨提示:此部分内容需要较强的数学能力,包括但不限于矩阵运算、坐标变换、数学几何。 一、数学知识 1.1 正逆运动学(几何法) 逆运动学解算函数 // 逆运动学-->计算出三个角度 void inverse_caculate(double x, double y, …...

路由VueRouter的基本使用

1.下载VueRouter到当前工程。 vue2:VueRouter3.x Vuex3.x。 vue3:VueRouter4.x Vuex4.x。 在终端使用命令: year add vue-router3.6.5 2.引入。 import VueRouter from vue-router 3,安装注册。 Vue.use(VueRouter) 4…...

Guiding a Diffusion Model with a Bad Version of Itself

Guiding a Diffusion Model with a Bad Version of Itself Abstract1. Introduction2. Background3. Why does CFG improve image quality?Score matching leads to outliers.CFG 消除异常值Discussion 4 Our method Abstract 在图像生成扩散模型中,主要关注的轴心…...

快速上手!低功耗Air724UG模组软件指南:FTP示例

Air724UG模组集成了高性能处理器和丰富的外设接口,支持多种通信协议,包括FTP(文件传输协议)。通过Air724UG模组,开发者可以轻松实现设备的远程文件管理功能。一起接着看下去吧! 一、简介 FTP(…...

GAMES101 完结篇(笔记和作业)

写在前面 我已经把笔记和作业代码放在了GitHub上,欢迎访问GAMES101笔记及作业 (github.com),如果对你有帮助,欢迎fork or star 下面我想简单介绍一下这里面的东西 Homework Homework文件夹里有0~8的作业框架,参考的其他大佬的代…...

3D Slicer与MONAI人工智能三维影像处理

如何又快又高效的做三维影像?勾画roi? 案例1 患者腹腔占位半月余,完善CT增强扫描,使用Slicer 对肿瘤,胰腺,动脉,静脉进行三维重建。重建时间1-5分钟。 案例2 胸部CT平扫,使用 slic…...

NC65客开单据自定义项处理以及自定义项相关介绍(超级详细带图以及代码NC65自定义项大全)

自定义项教程 自定义项和物料辅助属性简介 自定义档案的概念: NC系统中有大量的档案,这些档案中有相当一部分为系统预置的,鉴于用户对系统应用的个性化需求,系统支持用户自定用户自己的档案,并对其进行维护管理&…...

责任链模式的理解和实践

责任链模式(Chain of Responsibility)是行为型设计模式之一,它通过将多个对象连成一条链,并沿着这条链传递请求,直到有对象处理它为止。这个模式的主要目的是将请求的发送者和接收者解耦,使请求沿着处理链传…...

【大模型-向量库】详解向量库管理:连接管理、集合管理、向量管理

在向量数据库(Vector Database)中,向量库管理的概念是非常重要的,因为它涉及到如何高效地存储、索引和检索大规模的向量数据。向量库管理通常包括三个主要方面:连接管理、集合管理和向量管理。以下是对这三者的详细解释…...

MySQL书籍推荐

《高性能MySQL(第4版)》-西尔维亚博特罗斯 系统层次 Mysql性能优化和高可用架构实践 2020 系统基础 MySQL性能调优与架构设计 系统基础 Mysql技术大全 2021 综合 MySQL数据库应用案例教程 综合实战 从入门到项目实践 综合实战 丰富 超值 MySQ…...

常见的数据结构:

数据结构是计算机科学中的一个核心概念,它涉及到组织、管理和存储数据的方式,以便可以有效地访问和修改数据。数据结构的形式有很多,每种结构都有其特定的用途、优势和局限性。以下是一些常见的数据结构: 1. **数组(A…...

快速、高效的数据处理:深入了解 Polars 库

快速、高效的数据处理:深入了解 Polars 库 在数据科学和分析领域,Pandas 一直是 Python 数据处理的标杆。然而,随着数据量的增加,Pandas 在性能上的局限性逐渐显现。为了解决这一问题,越来越多的开发者开始寻找替代方…...

【LINUX】Linux 下打包与部署 Java 程序的全流程指南

文章目录 一、Java 程序打包1. 使用 Maven 打包2. 使用 Gradle 打包 二、运行 JAR 文件1. 前台运行2. 后台运行方法 1:使用 & 符号方法 2:使用 nohup 三、关闭运行中的程序1. 查找程序 PID2. 关闭程序 四、使用 Shell 脚本管理程序1. 创建 Shell 脚本…...

Spark 计算总销量

Spark 计算总销量 题目: 某电商平台存储了所有商品的销售数据,平台希望能够找到销量最好的前 N 个商品。通过分析销售记录,帮助平台决策哪些商品需要更多的推广资源。 假设你得到了一个商品销售记录的文本文件 product_id, product_name,…...

矩阵置零

矩阵置零 ​ 给定一个 m x n 的矩阵,如果一个元素为 0 ,则将其所在行和列的所有元素都设为 0 。请使用 原地算法。 示例 1: 输入:matrix [[1,1,1],[1,0,1],[1,1,1]] 输出:[[1,0,1],[0,0,0],[1,0,1]]示例 2&#xff…...

Ai编程cursor + sealos + devBox实现登录以及用户管理增删改查(十三)

一、什么是 Sealos? Sealos 是一款以 Kubernetes 为内核的云操作系统发行版。它以云原生的方式,抛弃了传统的云计算架构,转向以 Kubernetes 为云内核的新架构,使企业能够像使用个人电脑一样简单地使用云。 二、适用场景 业务运…...

深度解读:生产环境中的日志优化与大数据处理实践20241116

🌟 深度解读:生产环境中的日志优化与大数据处理实践 在现代软件开发中,日志是系统调试与问题排查的重要工具。然而,随着应用的复杂化和数据量的增长,传统日志模块在应对复杂嵌套对象、大数据类型时可能面临性能问题和安…...

docker 搭建gitlab,亲测可用

1、Gitlab镜像 查找Gitlab镜像 docker search gitlab 拉取Gitlab镜像 docker pull gitlab/gitlab-ce:latest 2、启动Gitlab容器 # 启动容器 docker run \-itd \-p 9980:80 \-p 9922:22 \-v /home/gitlab/etc:/etc/gitlab \-v /home/gitlab/log:/var/log/gitlab \-v /ho…...

SpringBoot 分层解耦

从没有分层思想到传统 Web 分层,再到 Spring Boot 分层架构 1. 没有分层思想 在最初的项目开发中,很多开发者并没有明确的分层思想,所有逻辑都堆砌在一个类或一个方法中。这样的开发方式通常会导致以下问题: 代码混乱&#xff1…...

opencv复习

目录 1.core 1.图像变换 1.1 affine仿射变换 1.2 透视变换 2.四元数(旋转) 2.1 轴角转四元数 2.2 旋转矩阵转四元数 2.3 欧拉角转旋转矩阵 2.4 四元数转旋转矩阵 2.5 四元数用eigen用的比较多 2. imgproc. Image Processing 2.1 bilateralF…...

flask-socketio相关总结

flask-socketio是一个为flask应用程序添加的实时双向通信功能的扩展库,有了这个库,就可以在flask应用中应用websocket协议,帮助flask实现低延迟、双向的客户端、服务端通信。客户端通过任何SocketIO官方库,都能与服务器建立长连接…...