I have separated the rgb channel into a new dataframe from x,y, z coord. Now I am stuck at iterating thw conversion calculations over 800k rows within the rgb dataframe. I dont know how to go through each of the element and convert them.
I have tried creating a loop over the dataframe and calculate them accordingly, but it doesnt change the values idk.
I have used the formulas given here: https://stackoverflow.com/a/56678483/12059118
p.s: I am a rookie so I know how ugly&stupıd my code looks like but that's just my starting :P
from pyntcloud import PyntCloud
import numpy as np
import pandas as pd
cloud = PyntCloud.from_file("longdress_vox10_1051.ply")
#print(cloud)
#scene = cloud.plot(return_scene=True)
data = cloud.points
df1 = data.iloc[:, 3:6]
df1= df1/255
for index, row in df1.iterrows():
if row <= 0.04045:
print(row)
row = row/12.92
print(row)
else:
row = ((row + 0.055)/1.055)**2.4
print(row)
print(row)
for i in range(len(df1)):
print(i.type())
if df1['red'][i] <= 0.04045:
df1['red'][i]= df1['red']/12.92
else:
df1['red'][i] = ((df1['red'][i] + 0.055)/1.055)**2.4
#print(df1.head(:3))
#df1['red'] = df1['red']*0.2126
#df1['green'] = df1['green']*0.7152
#df1['blue'] = df1['blue']*0.0722