The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
How to extract the RGB color composition of an image in value?
Learner I
in Help
I would like to extract the value percentage of each red, blue and green percentage of the image and put it as an attribute in database.
0
Best Answers
-
jacobcybulski
Member, University Professor Posts: 391
Unicorn
Install "Image Handling" extension, and there "Read Image as ExampleSet" will read the directory of images, and represent each image as an RGB tripple of values in the range 0..255.0 -
jacobcybulski
Member, University Professor Posts: 391
Unicorn
Try with one low resolution image, eg PNG, and see what happens.0
Answers
<?xml version="1.0" encoding="UTF-8"?><process version="9.8.001"> <context> <input/> <output/> <macros/> </context> <operator activated="true" class="process" compatibility="9.8.001" expanded="true" name="Process" origin="GENERATED_TUTORIAL"> <parameter key="logverbosity" value="init"/> <parameter key="random_seed" value="2001"/> <parameter key="send_mail" value="never"/> <parameter key="notification_email" value=""/> <parameter key="process_duration_for_mail" value="30"/> <parameter key="encoding" value="SYSTEM"/> <process expanded="true"> <operator activated="true" class="image_handling:read_image_meta_data" compatibility="0.2.001" expanded="true" height="68" name="Read Image Meta Data" origin="GENERATED_TUTORIAL" width="90" x="45" y="34"> <parameter key="directory" value="/home/jacob/Pictures/Wallpapers"/> <parameter key="use_label" value="false"/> </operator> <operator activated="true" class="image_handling:read_image_as_exampleset" compatibility="0.2.001" expanded="true" height="68" name="Read Image as ExampleSet" origin="GENERATED_TUTORIAL" width="90" x="179" y="34"> <parameter key="path" value="Path"/> <parameter key="height" value="Height"/> <parameter key="width" value="Width"/> <parameter key="number_of_color_channels" value="1"/> </operator> <operator activated="true" class="flatten_collection" compatibility="9.8.001" expanded="true" height="68" name="Flatten Collection" width="90" x="313" y="34"/> <operator activated="true" class="loop_collection" compatibility="9.8.001" expanded="true" height="82" name="Loop Collection" width="90" x="447" y="34"> <parameter key="set_iteration_macro" value="true"/> <parameter key="macro_name" value="iteration"/> <parameter key="macro_start_value" value="1"/> <parameter key="unfold" value="false"/> <process expanded="true"> <operator activated="true" class="extract_macro" compatibility="9.8.001" expanded="true" height="68" name="Extract Macro" width="90" x="179" y="34"> <parameter key="macro" value="last_attr"/> <parameter key="macro_type" value="number_of_attributes"/> <parameter key="statistics" value="average"/> <parameter key="attribute_name" value=""/> <list key="additional_macros"/> </operator> <operator activated="true" class="filter_example_range" compatibility="9.8.001" expanded="true" height="82" name="Filter Example Range" width="90" x="313" y="34"> <parameter key="first_example" value="1"/> <parameter key="last_example" value="100"/> <parameter key="invert_filter" value="false"/> </operator> <operator activated="true" class="remove_attribute_range" compatibility="9.8.001" expanded="true" height="82" name="Remove Attribute Range" width="90" x="447" y="34"> <parameter key="first_attribute" value="101"/> <parameter key="last_attribute" value="%{last_attr}"/> </operator> <operator activated="true" class="generate_attributes" compatibility="9.8.001" expanded="true" height="82" name="Generate Attributes" width="90" x="581" y="34"> <list key="function_descriptions"> <parameter key="imageno" value="%{iteration}"/> </list> <parameter key="keep_all" value="true"/> </operator> <connect from_port="single" to_op="Extract Macro" to_port="example set"/> <connect from_op="Extract Macro" from_port="example set" to_op="Filter Example Range" to_port="example set input"/> <connect from_op="Filter Example Range" from_port="example set output" to_op="Remove Attribute Range" to_port="example set input"/> <connect from_op="Remove Attribute Range" from_port="example set output" to_op="Generate Attributes" to_port="example set input"/> <connect from_op="Generate Attributes" from_port="example set output" to_port="output 1"/> <portSpacing port="source_single" spacing="0"/> <portSpacing port="sink_output 1" spacing="0"/> <portSpacing port="sink_output 2" spacing="0"/> </process> </operator> <operator activated="true" class="append" compatibility="9.8.001" expanded="true" height="82" name="Append" width="90" x="581" y="34"> <parameter key="datamanagement" value="double_array"/> <parameter key="data_management" value="auto"/> <parameter key="merge_type" value="all"/> </operator> <operator activated="true" class="set_role" compatibility="9.8.001" expanded="true" height="82" name="Set Role" width="90" x="715" y="34"> <parameter key="attribute_name" value="imageno"/> <parameter key="target_role" value="batch"/> <list key="set_additional_roles"/> </operator> <connect from_op="Read Image Meta Data" from_port="output" to_op="Read Image as ExampleSet" to_port="example set"/> <connect from_op="Read Image as ExampleSet" from_port="collection" to_op="Flatten Collection" to_port="collection"/> <connect from_op="Flatten Collection" from_port="flat" to_op="Loop Collection" to_port="collection"/> <connect from_op="Loop Collection" from_port="output 1" to_op="Append" to_port="example set 1"/> <connect from_op="Append" from_port="merged set" to_op="Set Role" to_port="example set input"/> <connect from_op="Set Role" from_port="example set output" to_port="result 1"/> <portSpacing port="source_input 1" spacing="0"/> <portSpacing port="sink_result 1" spacing="0"/> <portSpacing port="sink_result 2" spacing="0"/> <description align="left" color="yellow" colored="false" height="50" resized="true" width="327" x="39" y="126">Set the directory to a path which contains images.</description> </process> </operator> </process>