Highlighted

Changing the Color of Pixels

New Here ,
Apr 11, 2017

Copy link to clipboard

Copied

I'm incredibly new in the world of coding with Premiere, so my apologies if I'm not using the right terms...

I'm trying to write a plugin that will scan every pixel in a clip. I want it to act almost like a FCP Broadcast Safe filter, making the pixels that are too bright darker. I assumed that using an If-Else structure would be the best way to do this, however I don't know what to declare in the If statement. I'm using the Simple_Video_Filter example from the SDK package. Here's the section of the code I'm working on (again, apologies for how bad it is...)

                    for(int vert = 0; vert < height; ++vert)

                    {

                        for(int horiz = 0; horiz < width; ++horiz)

                        {

                            // Save off alpha

                            alpha = *srcpix & 0xff000000;

                            // Separate colors

                            redSource = (*srcpix & 0x00ff0000) >> 16;

                            greenSource = (*srcpix & 0x0000ff00) >> 8;

                            blueSource = *srcpix & 0x000000ff;

                            if (redSource == 0x00ff0000) {

                                redSource = *srcpix & 0x000000ff;

                                OutputDebugString(TEXT("Red detected."));

                            }

                            else {

                                OutputDebugString(TEXT("No Red."));

                            }

                          

                            *dstpix = (alpha | (redSource << 16) | (greenSource << 😎 | blueSource);

                            ++dstpix;

                            ++srcpix;

                        }

                        srcpix += (rowbytes / 4) - width;

                        dstpix += (rowbytes / 4) - width;

                    } // else

On a colour matte with the value of FF0000, it still prints out "No Red."

Can someone please advise, or at least point me in the right direction?

Thanks.

-Josh

Eddie, long time, great to see you on the forums!

Josh, stepping back a little further, I wanted to point out that the Simple_Video_Filter uses a legacy API and because of that it's been removed from the BuildAll .sln / .xcodeproj in the latest SDK.  We recommend starting from a sample effect project in the After Effects SDK.  For example the Portable sample is good if you just want 8-bit RGB.  Or the SDK_Noise sample if you want to support 32-bit float and even YUV-native processing.

Topics

Premiere Filter API, Premiere Pro SDK, Scripting, SDK

Views

829

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Changing the Color of Pixels

New Here ,
Apr 11, 2017

Copy link to clipboard

Copied

I'm incredibly new in the world of coding with Premiere, so my apologies if I'm not using the right terms...

I'm trying to write a plugin that will scan every pixel in a clip. I want it to act almost like a FCP Broadcast Safe filter, making the pixels that are too bright darker. I assumed that using an If-Else structure would be the best way to do this, however I don't know what to declare in the If statement. I'm using the Simple_Video_Filter example from the SDK package. Here's the section of the code I'm working on (again, apologies for how bad it is...)

                    for(int vert = 0; vert < height; ++vert)

                    {

                        for(int horiz = 0; horiz < width; ++horiz)

                        {

                            // Save off alpha

                            alpha = *srcpix & 0xff000000;

                            // Separate colors

                            redSource = (*srcpix & 0x00ff0000) >> 16;

                            greenSource = (*srcpix & 0x0000ff00) >> 8;

                            blueSource = *srcpix & 0x000000ff;

                            if (redSource == 0x00ff0000) {

                                redSource = *srcpix & 0x000000ff;

                                OutputDebugString(TEXT("Red detected."));

                            }

                            else {

                                OutputDebugString(TEXT("No Red."));

                            }

                          

                            *dstpix = (alpha | (redSource << 16) | (greenSource << 😎 | blueSource);

                            ++dstpix;

                            ++srcpix;

                        }

                        srcpix += (rowbytes / 4) - width;

                        dstpix += (rowbytes / 4) - width;

                    } // else

On a colour matte with the value of FF0000, it still prints out "No Red."

Can someone please advise, or at least point me in the right direction?

Thanks.

-Josh

Eddie, long time, great to see you on the forums!

Josh, stepping back a little further, I wanted to point out that the Simple_Video_Filter uses a legacy API and because of that it's been removed from the BuildAll .sln / .xcodeproj in the latest SDK.  We recommend starting from a sample effect project in the After Effects SDK.  For example the Portable sample is good if you just want 8-bit RGB.  Or the SDK_Noise sample if you want to support 32-bit float and even YUV-native processing.

Topics

Premiere Filter API, Premiere Pro SDK, Scripting, SDK

Views

830

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Contributor ,
Apr 19, 2017

Copy link to clipboard

Copied

Change the line

if (redSource == 0x00ff0000) {

to

if (redSource == 0x000000ff) {

and you will see the test "Red detected" if any of the pixels contain full red.
However, what you do with it also seems suspect.

Cheers
Eddie

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Employee ,
Apr 21, 2017

Copy link to clipboard

Copied

Eddie, long time, great to see you on the forums!

Josh, stepping back a little further, I wanted to point out that the Simple_Video_Filter uses a legacy API and because of that it's been removed from the BuildAll .sln / .xcodeproj in the latest SDK.  We recommend starting from a sample effect project in the After Effects SDK.  For example the Portable sample is good if you just want 8-bit RGB.  Or the SDK_Noise sample if you want to support 32-bit float and even YUV-native processing.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Contributor ,
Apr 22, 2017

Copy link to clipboard

Copied

Eddie, long time, great to see you on the forums!

Hey Zac.

Yes, I'm still rattling around here.

Cheers

Eddie

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...