to explain the situation. Im getting some source image at a 320 x 480 resolution and apply the sobel filter for now. But the result in my mtk view is a tiny rectangle at the top right because of this resolution and so I want to resize the texture before applying the sober filter.
-
-
Replying to @jippoew
Oh, you want to upsample from the source first? In that case, MPSImageScale up to the desired size (yes, you have to compute the dest size manually); at worst use Lanczos (you probably don’t need it); then feed that to your Sobel.
1 reply 0 retweets 0 likes -
Sorry if this is obtuse; I really should write a new article about all of this
1 reply 0 retweets 0 likes -
Replying to @warrenm
Ah I didn't even know sobel is only applied to 1:1 aspect images, I'm using it on something 320 x 240. But yes that's exactly what I'm trying to do. So the thing to do is have one intermediate texture of the same size as my drawable?
2 replies 0 retweets 0 likes -
Replying to @jippoew
Sorry, I meant Sobel’s input dimensions are the same as the output, not to imply the aspect ratio has to be 1:1. But yes, it sounds like you want to allocate an intermediate texture that is the size expected as the output of your upsampling kernel.
1 reply 0 retweets 0 likes -
Replying to @warrenm
Thanks a lot! I'm gonna see if I can get it to work!
1 reply 0 retweets 0 likes -
-
Replying to @warrenm
Hm still can't get the resizing to work. Are there any examples of attaching the ScaleTransform to the filter you know of? I couldn't find any, even in the documentation.
1 reply 0 retweets 0 likes -
-
Seems to be working as expected here, though of course Swift makes working with pointers miserable. Hope this helps:https://www.dropbox.com/s/f6k5t9b5dbut6tb/MPSImageScaleSample.zip?dl=0 …
-
-
Replying to @warrenm
Great! It works. I was also able to chain other filters in your example. Now I'm gonna try to get it working in my own project.
0 replies 0 retweets 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Let me know how it goes!