国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

【計(jì)算機(jī)圖形學(xué)】【代碼復(fù)現(xiàn)】A-SDF中的數(shù)據(jù)集制作與數(shù)據(jù)生成

這篇具有很好參考價(jià)值的文章主要介紹了【計(jì)算機(jī)圖形學(xué)】【代碼復(fù)現(xiàn)】A-SDF中的數(shù)據(jù)集制作與數(shù)據(jù)生成。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

Follow A-SDF 的Data Generation部分:
We follow
(1) ANSCH to create URDF for shape2motion dataset
(1-2) URDF2OBJ(本人認(rèn)為是1-2之間需要進(jìn)行的重要的過渡部分)
(2) Manifold to create watertight meshes
(3) and modified mesh_to_sdf for generating sampled points and sdf values.

1. ANSCH to create URDF for shape2motion dataset

follow這個(gè)github: ANSCH

(1)克隆數(shù)據(jù)集,編輯自己的路徑信息

git clone https://github.com/dragonlong/articulated-pose.git # 克隆倉(cāng)庫(kù)
# global_info主要放路徑信息,通過下行命令編輯路徑信息
vim global_info.py

global_info.py中,主要修改192行的self.base_path路徑,改成克隆下來文件夾的位置,我這里改成/mnt/d/sdc/liutong/codes/articulated-pose

(2)Shape2Motion數(shù)據(jù)集的解壓和使用

因?yàn)檫@里需要使用到Shape2Motion數(shù)據(jù)集,所以下載一下,Shape2Motion項(xiàng)目主頁(yè):Shape2Motion,Shape2Motion下載鏈接:Shape2Motion下載鏈接

下載好Shape2Motion數(shù)據(jù)集后,在zip文件路徑做如下操作

unzip 'Motion Dataset v0.zip' # 解壓數(shù)據(jù)集
mv 'Motion Dataset v0' shape2motion # 重命名數(shù)據(jù)集
mv shape2motion /mnt/d/sdc/liutong/codes/articulated-pose/dataset/ # 將數(shù)據(jù)集移動(dòng)到目標(biāo)目錄下

(3)json2urdf

follow github上的操作:

cd tools # 進(jìn)入工具文件夾
python json2urdf.py	# 執(zhí)行python2urdf

可能會(huì)出現(xiàn)以下報(bào)錯(cuò),根據(jù)報(bào)錯(cuò)進(jìn)行修改后重復(fù)運(yùn)行python json2urdf.py

這時(shí)候報(bào)錯(cuò)1

Traceback (most recent call last):
  File "/mnt/d/sdc/liutong/codes/articulated-pose/tools/json2urdf.py", line 62, in <module>
    all_objs     = os.listdir( base_path  + dataset  + '/objects' )
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/d/sdc/liutong/codes/articulated-pose/dataset/shape2motion/objects'
(gapartnet) root@szu-SYS-7048GR-TR:/mnt/d/sdc/liutong/codes/articulated-pose/tools# ls -l ../dadtaset/shape2motion

經(jīng)檢查,是Shape2Motion下沒有objects文件夾,所以我將報(bào)錯(cuò)的62行進(jìn)行更改如下,確保這部分可以正常運(yùn)行:

# 從
all_objs     = os.listdir( base_path  + dataset  + '/objects' )
# 更改至
all_objs     = os.listdir( base_path  + dataset )

同理,73行中的路徑代碼因?yàn)橐灿?code>objects,所以肯定也會(huì)出問題,同樣進(jìn)行修改:

# 從
instances_per_obj = sorted(glob.glob(base_path  + dataset  + '/objects/' + obj_name + '/*'))
# 更改至
instances_per_obj = sorted(glob.glob(base_path  + dataset + '/' + obj_name + '/*'))

接著會(huì) 報(bào)錯(cuò)2
Traceback (most recent call last):
  File "/mnt/d/sdc/liutong/codes/articulated-pose/tools/json2urdf.py", line 87, in <module>
    with open(json_name[0]) as json_file:
IndexError: list index out of range

這是因?yàn)榍懊孢\(yùn)行的時(shí)候在dataset/shape2motion/下生成了一個(gè)urdf文件夾,這里面是生成的結(jié)果,所以會(huì)導(dǎo)致讀取不到.json文件,所以只需要執(zhí)行:

rm -rf dataset/shape2motion/urdf

即可?;蛘咭粍谟酪莸馗牡?code>urdf的保存路徑(前面的更改我沒有把舊代碼刪掉,而注釋舊代碼,在下面添加新代碼,所以我這里保存路徑是在85行)。這里有個(gè)小小的擔(dān)心是會(huì)不會(huì)后續(xù)條件下也要對(duì)urdf的路徑進(jìn)行修改

# 從
save_dir     = base_path + '/' + dataset  + '/urdf/{}/{}'.format(obj_name, instance_name) # todo
# 更改至
save_dir     = base_path + 'urdf/{}/{}'.format(obj_name, instance_name)

接著會(huì) 報(bào)錯(cuò)3
Traceback (most recent call last):
  File "/mnt/d/sdc/liutong/codes/articulated-pose/tools/json2urdf.py", line 224, in <module>
    f.write('{}/{}\t'.format(obj_j['revolute'], obj_j['prismatic']))
KeyError: 'revolute'

發(fā)現(xiàn)是因?yàn)橛械?code>obj_j為空造成的,故更改如下:

# 從
with open(base_path + '/' + dataset + '/statistics.txt', "a+") as f:
	for obj_j in object_joints:
		f.write('{}/{}\t'.format(obj_j['revolute'], obj_j['prismatic']))
    f.write('\n')
# 更改至
with open(base_path + '/' + dataset + '/statistics.txt', "a+") as f:
	for obj_j in object_joints:
		if not len(obj_j) == 0:
			f.write('{}/{}\t'.format(obj_j['revolute'], obj_j['prismatic']))
		else:
			f.write('NAN/NAN\t')
    f.write('\n')

雖然ANSCH后續(xù)還有一些渲染數(shù)據(jù)的操作,但是這里我們只需要拿到URDF就足夠了

1-2. URDF2OBJ

在這一步,我follow了一個(gè)已經(jīng)寫好的github代碼:urdf_to_obj
由于我們得到的文件形式是這樣的:
【計(jì)算機(jī)圖形學(xué)】【代碼復(fù)現(xiàn)】A-SDF中的數(shù)據(jù)集制作與數(shù)據(jù)生成
【計(jì)算機(jī)圖形學(xué)】【代碼復(fù)現(xiàn)】A-SDF中的數(shù)據(jù)集制作與數(shù)據(jù)生成
我們要取的是這下邊的syn.urdf來進(jìn)行最終結(jié)果的合成,我根據(jù)這個(gè)文件格式改了一下我上面提及的github的代碼,更改后的代碼urdf_to_obj如下,參數(shù)釋義:
--urdf_file_dir:urdf文件夾的路徑
--output_dir:輸出文件夾的路徑
--angle:用于給輸出obj文件命名時(shí)候用的,你生成的是多少度就寫多少度就好了(并不是在這里指定角度就能夠?qū)崿F(xiàn)生成)

from urdfpy import URDF
import numpy as np
import trimesh
import argparse
import meshes_extracted
import os

def merge_meshes(mesh_list):
    """Merge a list of meshes into a single mesh
    
    Parameters:
    - mesh_list (list): list of trimesh.Trimesh objects
    
    Returns:
    - mesh (trimesh.Trimesh): merged mesh"""

    # Get vertices and faces
    verts_list = [mesh.vertices for mesh in mesh_list]
    faces_list = [mesh.faces for mesh in mesh_list]

    # Num of faces per mesh
    faces_offset = np.cumsum([v.shape[0] for v in verts_list], dtype=np.float32) 

    # Compute offset for faces, otherwise they all start from 0
    faces_offset = np.insert(faces_offset, 0, 0)[:-1]            

    verts = np.vstack(verts_list)
    faces = np.vstack([face + offset for face, offset in zip(faces_list, faces_offset)])

    # Create single mesh
    mesh = trimesh.Trimesh(verts, faces)

    return mesh


def main(args):
    """Extract meshes from a URDF file and save them as .obj files"""

    # Load urdf file dir
    urdf_file_dir = args.urdf_file_dir

    output_dir = args.output_dir

    # Load other parameters
    object_angle = args.angle

    # Get the sub_dir under urdf_file_dir, and then 0001/0002/0003/0004/0005
    urdf_root = sorted(os.listdir(urdf_file_dir))

    for urdf_dir in urdf_root:
        # urdf_file_path be like 0001/syn.urdf, 0002/syn.urdf, 0003/syn.urdf, etc
        urdf_file_path = os.path.join(urdf_file_dir, urdf_dir, 'syn.urdf')
        output_path = os.path.join(output_dir, f'{urdf_dir}art{object_angle}.obj')

        # Load urdf file
        robot = URDF.load(urdf_file_path)

        meshes = robot.visual_trimesh_fk()

        mesh_list = []

        for idx, mesh in enumerate(meshes):

            pose = meshes[mesh]   # 4 x 4 : rotation + translation

            translation = pose[:3, 3][:, None]
            
            # Add a column of zeros to the vertices
            verts = np.array(mesh.vertices)
            zeros = np.zeros((verts.shape[0], 1))
            new_verts = np.hstack((verts, zeros))

            # Apply pose to the vertices
            verts_pose = pose @ new_verts.transpose(1, 0) 
            verts_pose = verts_pose[:3, :] + translation   
            verts_pose = verts_pose.transpose(1, 0)
                
            mesh_extracted = trimesh.Trimesh(verts_pose, mesh.faces)

            mesh_list.append(mesh_extracted)

        # Merge meshes
        mesh_merged = merge_meshes(mesh_list)

        # Save merged meshes
        print('save ' + str(output_path))
        trimesh.exchange.export.export_mesh(mesh_merged, output_path, file_type='obj')


if __name__=='__main__':
    parser = argparse.ArgumentParser()

    parser.add_argument(
        "--urdf_file_dir", default='', type=str, help="Path to the .urdf file", required=True
    )
    parser.add_argument(
        "--output_dir", default='', type=str, help="Path to the output dir", required=True
    )
    parser.add_argument(
        "--angle", default='', type=str, help="Angle of objects, be used to name the file", required=True
    )
    args = parser.parse_args()

    main(args)

運(yùn)行示例:

 python urdf_to_obj_group.py --urdf_file_dir /mnt/d/sdc/liutong/codes/articulated-pose/dataset/shape2motion/urdf/door --output_dir obj_tmp --angle 90

報(bào)錯(cuò)如下:

Traceback (most recent call last):
  File "urdf_to_obj_group.py", line 104, in <module>
    main(args)
  File "urdf_to_obj_group.py", line 56, in main
    robot = URDF.load(urdf_file_path)
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 3729, in load
    return URDF._from_xml(node, path)
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 3926, in _from_xml
    kwargs = cls._parse(node, path)
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 161, in _parse
    kwargs.update(cls._parse_simple_elements(node, path))
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 137, in _parse_simple_elements
    v = [t._from_xml(n, path) for n in vs]
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 137, in <listcomp>
    v = [t._from_xml(n, path) for n in vs]
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 181, in _from_xml
    return cls(**cls._parse(node, path))
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 161, in _parse
    kwargs.update(cls._parse_simple_elements(node, path))
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 137, in _parse_simple_elements
    v = [t._from_xml(n, path) for n in vs]
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 137, in <listcomp>
    v = [t._from_xml(n, path) for n in vs]
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 1146, in _from_xml
    kwargs = cls._parse(node, path)
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 161, in _parse
    kwargs.update(cls._parse_simple_elements(node, path))
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 127, in _parse_simple_elements
    v = t._from_xml(v, path)
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 181, in _from_xml
    return cls(**cls._parse(node, path))
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 161, in _parse
    kwargs.update(cls._parse_simple_elements(node, path))
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 127, in _parse_simple_elements
    v = t._from_xml(v, path)
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/urdf.py", line 581, in _from_xml
    meshes = load_meshes(fn)
  File "/home/liutong/anaconda3/envs/gapartnet/lib/python3.8/site-packages/urdfpy/utils.py", line 235, in load_meshes
    raise ValueError('At least one mesh must be pmeshesent in file')
ValueError: At least one mesh must be pmeshesent in file

其實(shí)使用原始github連接中的python urdf_to_obj.py --urdf_path relative/path/to/urdf來進(jìn)行試驗(yàn)的話,會(huì)發(fā)現(xiàn)0001的syn.urdf文件會(huì)報(bào)這樣的錯(cuò)誤,而0002的syn.urdf文件就不會(huì)報(bào)這樣的錯(cuò)誤。
經(jīng)過仔細(xì)地檢查發(fā)現(xiàn),實(shí)際上是因?yàn)?001的syn.urdf中,mesh - none_motion.obj的vertices數(shù)量為空所導(dǎo)致的,但是因?yàn)檫@個(gè)錯(cuò)誤是包里的錯(cuò)誤,所以我也不知道應(yīng)該怎么進(jìn)行修改比較合適。
最后我是直接刪掉會(huì)產(chǎn)生這個(gè)異常的文件夾,最后不會(huì)產(chǎn)生異常的文件夾應(yīng)該只有51個(gè)。

2. Manifold to create watertight meshes

這一步實(shí)際上就是縮減網(wǎng)格數(shù)量,因?yàn)樵镜木W(wǎng)格太密集了
follow這個(gè)github: Manifold
follow里面的Install進(jìn)行安裝就可以了
然后我根據(jù)它的命令,用python寫了一個(gè)自動(dòng)執(zhí)行減少網(wǎng)格數(shù)量的程序,其中要用到的參數(shù)如下:
--obj_file_dir:放置了URDF2OBJ的那些obj文件的文件夾
--target_dir:輸出文件夾路徑

import os
import argparse

# res = os.popen('ls').read()
# print(res)

def main(args):
    # Load obj file dir
    obj_file_dir = args.obj_file_dir
    target_dir = args.target_dir

    obj_files = sorted(os.listdir(obj_file_dir))

    for obj in obj_files:
        source_obj = os.path.join(obj_file_dir, obj)
        obj = "manifold_" + obj
        target_obj = os.path.join(target_dir, obj)
        
        res = os.popen('./manifold ' + source_obj + ' ' + target_obj).read()
        print(res)
        

if __name__=='__main__':
    parser = argparse.ArgumentParser()

    parser.add_argument(
        "--obj_file_dir", default='', type=str, help="Path to the .obj file dir", required=True
    )
    parser.add_argument(
        "--target_dir", default='', type=str, help="Path to the target dir", required=True
    )
    args = parser.parse_args()


    main(args)

這是得到的結(jié)果:
【計(jì)算機(jī)圖形學(xué)】【代碼復(fù)現(xiàn)】A-SDF中的數(shù)據(jù)集制作與數(shù)據(jù)生成

3. modified mesh_to_sdf for generating sampled points and sdf values

follow 這個(gè)github: mesh_to_sdf
按照里面的步驟安裝好
這一步實(shí)際上就是做sdf采樣了,像A-SDF里的話采樣好像是保存成一些.npy還是.npz文件的,但是我這里根據(jù)我自己的需要,需要采樣并保存到.mat文件中,下面提供一個(gè)保存到.mat文件中的代碼:
--manifold_obj_dir: 上一步manifold減少網(wǎng)格數(shù)量后的結(jié)果
--output_dir: .mat文件的保存路徑

import os

import mesh_to_sdf
# from mesh_to_sdf import sample_sdf_near_surface

import trimesh
import inspect
import pyrender
import numpy as np
import scipy
from scipy.io import savemat
from plyfile import PlyData
import argparse
os.environ['PYOPENGL_PLATFORM'] = 'egl'


def calculate_ply_center(mesh):
    # 獲取頂點(diǎn)數(shù)據(jù)
    vertices = mesh.vertices

    # 提取頂點(diǎn)坐標(biāo)
    x_coords = vertices[:, 0]
    y_coords = vertices[:, 1]
    z_coords = vertices[:, 2]

    # 計(jì)算頂點(diǎn)坐標(biāo)的平均值
    center_x = np.mean(x_coords)
    center_y = np.mean(y_coords)
    center_z = np.mean(z_coords)

    return center_x, center_y, center_z


def scale_to_specific_sphere(mesh):
    vertices = mesh.vertices - calculate_ply_center(mesh)
    distances = np.linalg.norm(vertices, axis=1)
    vertices /= np.max(distances) / 1.03
    return trimesh.Trimesh(vertices=vertices, faces=mesh.faces)


if __name__ == "__main__":

    print(inspect.getfile(mesh_to_sdf))

    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--manifold_obj_dir", default='./Manifold_result', type=str, help="Path to .obj file dir"
    )
    parser.add_argument(
        "--output_dir", default='./All_result', type=str, help="Path to the .mat dir"
    )
    args = parser.parse_args()

    manifold_obj_dir = args.manifold_obj_dir
    save_dir = args.output_dir

    if not os.path.exists(os.path.join(save_dir, 'surface_pts_n_normal')):
        os.mkdir(os.path.join(save_dir, 'surface_pts_n_normal'))
    if not os.path.exists(os.path.join(save_dir, 'free_space_pts')):
        os.mkdir(os.path.join(save_dir, 'free_space_pts'))
    save_surface_dir = os.path.join(save_dir, 'surface_pts_n_normal')
    save_free_dir = os.path.join(save_dir, 'free_space_pts')

    manifold_dirs = os.listdir(manifold_obj_dir)
    for dirs in manifold_dirs:
        files = os.listdir(os.path.join(manifold_obj_dir, dirs))
        for file_ in files:
            print("Process " + str(file_) + " ......")
            mesh = trimesh.load(os.path.join(manifold_obj_dir, dirs, file_))
            mesh = scale_to_specific_sphere(mesh)

            surface = mesh_to_sdf.get_surface_point_cloud(mesh, surface_point_method='scan', sample_point_count=1000)
            surface_points = surface.points
            surface_normals = surface.normals
            surface_data = np.concatenate((surface_points, surface_normals), axis=1)
            surface_data = {'p': surface_data}

            free_p, free_sdf = mesh_to_sdf.sample_sdf_in_cube(mesh, surface_point_method='scan', number_of_points=1000,
                                                              sample_point_count=1000, sign_method='depth')
            free_sdf = free_sdf.reshape(-1, 1)
            free_data = np.concatenate((free_p, free_sdf), axis=1)
            free_data = {'p_sdf': free_data}

            print("Saving " + str(str(file_.split("_")[-1]).split('.')[0])+'.mat'  + " to " + str(os.path.join(save_surface_dir, str(str(file_.split("_")[-1]).split('.')[0])+'.mat')))
            savemat(os.path.join(save_surface_dir, str(str(file_.split("_")[-1]).split('.')[0])+'.mat'), surface_data)
            print("Saving " + str(str(file_.split("_")[-1]).split('.')[0])+'.mat'  + " to " + str(os.path.join(save_free_dir, str(str(file_.split("_")[-1]).split('.')[0])+'.mat')))
            savemat(os.path.join(save_free_dir, str(str(file_.split("_")[-1]).split('.')[0])+'.mat'), free_data)

# # 加載DIF原本的free_space_pts,查看可視化效果
# result = scipy.io.loadmat('free_space_cbc47018135fc1b1462977c6d3c24550.mat')['p_sdf']
# free_p = result[:, :3]
# free_sdf = result[:, 3:]
# free_sdf = free_sdf.reshape(-1)
# print(free_p.shape)
# print(free_sdf.shape)


# # 可視化free_space_pts的點(diǎn)
# colors = np.zeros(free_p.shape)
# colors[free_sdf < 0, 2] = 1
# colors[free_sdf > 0, 0] = 1
# cloud = pyrender.Mesh.from_points(free_p, colors=colors)
# scene = pyrender.Scene()
# scene.add(cloud)
# viewer = pyrender.Viewer(scene, use_raymond_lighting=True, point_size=2)

得到的結(jié)果如下:
【計(jì)算機(jī)圖形學(xué)】【代碼復(fù)現(xiàn)】A-SDF中的數(shù)據(jù)集制作與數(shù)據(jù)生成
最終得到的這些SDF對(duì)文件,只需要放到目標(biāo)路徑文件夾下進(jìn)行使用就好了文章來源地址http://www.zghlxwxcb.cn/news/detail-472621.html

到了這里,關(guān)于【計(jì)算機(jī)圖形學(xué)】【代碼復(fù)現(xiàn)】A-SDF中的數(shù)據(jù)集制作與數(shù)據(jù)生成的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 計(jì)算機(jī)圖形學(xué):三次Bezier曲線的繪制(算法原理及代碼實(shí)現(xiàn))

    計(jì)算機(jī)圖形學(xué):三次Bezier曲線的繪制(算法原理及代碼實(shí)現(xiàn))

    一、實(shí)現(xiàn)方案 ? ? ? ?貝塞爾曲線原理:貝塞爾曲線是計(jì)算機(jī)圖形圖像造型的基本工具,是圖形造型運(yùn)用得最多的基本線條之一。它通過控制曲線上的四個(gè)點(diǎn)(起始點(diǎn)、終止點(diǎn)以及兩個(gè)相互分離的中間點(diǎn))來創(chuàng)造、編輯圖形。其中起重要作用的是位于曲線中央的控制線。這條

    2024年02月11日
    瀏覽(25)
  • (五·二)計(jì)算機(jī)圖形學(xué) 之 Unity代碼調(diào)用Shader并修改屬性值

    直接劃重點(diǎn): 在C#代碼中,要先引用材質(zhì)球(Material),然后通過材質(zhì)球提供的方法比如: 我這里使用material.SetColor(\\\"_Color\\\", Color.red); 結(jié)構(gòu)是SetColor(shader屬性名稱,屬性值設(shè)置); _Color是在shader中,Properties{}里定義好的屬性,名稱要一直,然后就是給他賦值。 Shader代碼: C#代碼

    2024年02月15日
    瀏覽(16)
  • 【計(jì)算機(jī)圖形學(xué)】【實(shí)驗(yàn)報(bào)告】太陽(yáng)系繪制、B樣條曲線繪制(附代碼)

    【計(jì)算機(jī)圖形學(xué)】【實(shí)驗(yàn)報(bào)告】太陽(yáng)系繪制、B樣條曲線繪制(附代碼)

    實(shí) 驗(yàn) 報(bào) 告 一、實(shí)驗(yàn)?zāi)康?掌握三維圖形的顯示原理和方法,掌握三維觀察的原理和方法; 掌握OpenGL中矩陣堆棧函數(shù)的使用,會(huì)使用堆棧函數(shù)進(jìn)行復(fù)雜場(chǎng)景的組裝。 掌握OpenGL中三維觀察變換常用的函數(shù)的使用方法,了解三維模型的貼圖方法; 掌握自由曲線的生成方法,熟練

    2024年02月10日
    瀏覽(31)
  • 基于計(jì)算機(jī)視覺手勢(shì)識(shí)別控制系統(tǒng)YoloGesture (利用YOLO實(shí)現(xiàn)) 有詳細(xì)代碼+部署+在線服務(wù)器嘗試+開源可復(fù)現(xiàn)

    基于計(jì)算機(jī)視覺手勢(shì)識(shí)別控制系統(tǒng)YoloGesture (利用YOLO實(shí)現(xiàn)) 有詳細(xì)代碼+部署+在線服務(wù)器嘗試+開源可復(fù)現(xiàn)

    Streamlit在線服務(wù)器體驗(yàn)網(wǎng)址: https://kedreamix-yologesture.streamlit.app/ HuggingFace在線服務(wù)器體驗(yàn)網(wǎng)址:https://huggingface.co/spaces/Kedreamix/YoloGesture 為了解答大家的問題,我錄了個(gè)視頻,大家也可以看看,https://www.bilibili.com/video/BV1LV4y1d7pg/,如果有問題可以在github上給我發(fā)issue進(jìn)行探討,

    2024年02月03日
    瀏覽(96)
  • 【計(jì)算機(jī)圖形學(xué)】二維圖形裁剪算法

    【計(jì)算機(jī)圖形學(xué)】二維圖形裁剪算法

    Cohen-Sutherland算法 Cohen-Sutherland是最早最流行的算法。 核心思想:通過 編碼測(cè)試 來減少計(jì)算交點(diǎn)的次數(shù)。(編碼算法) 1. 區(qū)域碼: 線段端點(diǎn)以區(qū)域賦值以四位二進(jìn)制碼。 編碼順序:四位從右到左分別為:左邊界、右邊界、下邊界、上邊界。 編碼值:落在相應(yīng)位置為1,否則

    2024年02月02日
    瀏覽(20)
  • 初識(shí)計(jì)算機(jī)圖形學(xué)

    初識(shí)計(jì)算機(jī)圖形學(xué)

    筆記來源:【老奇】陰差陽(yáng)錯(cuò) 撼動(dòng)世界的游戲引擎 詳見本人博客: 1.Transformation 2.梳理從MVP變換到光柵化的過程 MVP變換將空間中3D物體投影到2D屏幕 詳見本人博客: 1.Rasterization(光柵化) 2.梳理從MVP變換到光柵化的過程 場(chǎng)景是一個(gè)個(gè)由三角面組成的模型 將模型投射到像素就

    2024年01月21日
    瀏覽(22)
  • 計(jì)算機(jī)圖形與圖像技術(shù)

    計(jì)算機(jī)圖形與圖像技術(shù)

    可以使用Python、Java等語(yǔ)言。 下圖中,圖中各事物比例失調(diào) 如何使用代碼去掉某個(gè)人(不允許使用摳圖工具)? ????????像素(Pixel)是“圖像元素”的縮寫, 指的是圖像的最小單位 。 它是構(gòu)成數(shù)碼圖像或屏幕顯示圖像的基本單元,代表了圖像中的一個(gè)小點(diǎn)或一個(gè)小方塊

    2024年02月07日
    瀏覽(29)
  • 計(jì)算機(jī)圖形學(xué)——大作業(yè)

    計(jì)算機(jī)圖形學(xué)——大作業(yè)

    繪制一個(gè)簡(jiǎn)單的三維場(chǎng)景,可以是室內(nèi):臥室,辦公室,教室,也可以是室外:運(yùn)動(dòng)場(chǎng),公園等,加上光照效果,簡(jiǎn)單的紋理映射,透視投影;不能過于簡(jiǎn)單;可以加動(dòng)畫、鼠標(biāo)和鍵盤交互。 ??? 上交材料: project和word文檔(具體內(nèi)容展示,思路和心得) 首先初始化窗口,

    2024年02月11日
    瀏覽(19)
  • 【計(jì)算機(jī)圖形學(xué)】曲線和曲面

    【計(jì)算機(jī)圖形學(xué)】曲線和曲面

    模塊5 曲線和曲面 一 實(shí)驗(yàn)?zāi)康?編寫曲線和曲面的算法 二 實(shí)驗(yàn)內(nèi)容 1 :繪制Bezier曲線,并采用自行設(shè)計(jì)輸入和交互修改數(shù)據(jù)點(diǎn)的方式。 實(shí)驗(yàn)結(jié)果如下圖所示: 第一步:輸入特征多邊形的頂點(diǎn)個(gè)數(shù),并按照順序輸入頂點(diǎn)的坐標(biāo)。 第二步:點(diǎn)擊左鍵生成bezier曲線(白色部分)和

    2024年02月06日
    瀏覽(24)
  • 【計(jì)算機(jī)圖形學(xué)01】坐標(biāo)變換

    【計(jì)算機(jī)圖形學(xué)01】坐標(biāo)變換

    ?????????將坐標(biāo)變換為標(biāo)準(zhǔn)化設(shè)備坐標(biāo),接著再轉(zhuǎn)化為屏幕坐標(biāo)的過程通常是分步進(jìn)行的,也就是類似于流水線那樣子。在流水線中,物體的頂點(diǎn)在最終轉(zhuǎn)化為屏幕坐標(biāo)之前還會(huì)被變換到多個(gè)坐標(biāo)系統(tǒng)(Coordinate System)。將物體的坐標(biāo)變換到幾個(gè) 過渡 坐標(biāo)系(Intermediate Coor

    2024年02月10日
    瀏覽(22)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包