Filter that gives the max change in matrix value












1












$begingroup$


I have a 3x3 matrix, I want to find the maximum change in value that any one element in the vector has with the centre element (given that this element has the opposite sign to the centre element).
Out of curiosity, would there be a filter that I could convolve with the matrix, which would give me this output?



say I have this matrix:
begin{bmatrix}
1 & 2 & 3\
2 &-1 & 3\
1 & 5& 2
end{bmatrix}

would there be a filter that could give the output $6$?










share|cite|improve this question











$endgroup$

















    1












    $begingroup$


    I have a 3x3 matrix, I want to find the maximum change in value that any one element in the vector has with the centre element (given that this element has the opposite sign to the centre element).
    Out of curiosity, would there be a filter that I could convolve with the matrix, which would give me this output?



    say I have this matrix:
    begin{bmatrix}
    1 & 2 & 3\
    2 &-1 & 3\
    1 & 5& 2
    end{bmatrix}

    would there be a filter that could give the output $6$?










    share|cite|improve this question











    $endgroup$















      1












      1








      1





      $begingroup$


      I have a 3x3 matrix, I want to find the maximum change in value that any one element in the vector has with the centre element (given that this element has the opposite sign to the centre element).
      Out of curiosity, would there be a filter that I could convolve with the matrix, which would give me this output?



      say I have this matrix:
      begin{bmatrix}
      1 & 2 & 3\
      2 &-1 & 3\
      1 & 5& 2
      end{bmatrix}

      would there be a filter that could give the output $6$?










      share|cite|improve this question











      $endgroup$




      I have a 3x3 matrix, I want to find the maximum change in value that any one element in the vector has with the centre element (given that this element has the opposite sign to the centre element).
      Out of curiosity, would there be a filter that I could convolve with the matrix, which would give me this output?



      say I have this matrix:
      begin{bmatrix}
      1 & 2 & 3\
      2 &-1 & 3\
      1 & 5& 2
      end{bmatrix}

      would there be a filter that could give the output $6$?







      matrices convolution image-processing






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Dec 12 '18 at 14:30









      Arthur

      116k7116199




      116k7116199










      asked Dec 12 '18 at 14:19









      HdotHdot

      82




      82






















          2 Answers
          2






          active

          oldest

          votes


















          0












          $begingroup$

          No, because the function $f$ that you are interested in is a nonlinear function of the input matrix, while convolving matrices $A, B$ with a filter $F$ would always satisfy $$convolve(F, A+B) = convolve(F, A) + convolve(F, B).$$



          To see that the function you are interested in is nonlinear, consider the sum of two matrices
          $$ A+ B =
          left[begin{array}{ccc}
          0 & 0 & 0 \
          0 & -1 & 0 \
          0 & 5 & 0 \
          end{array}right] +
          left[begin{array}{ccc}
          0 & 4 & 0 \
          0 & -2 & 0 \
          0 & 0 & 0 \
          end{array}right] =
          left[begin{array}{ccc}
          0 & 4 & 0 \
          0 & -3 & 0 \
          0 & 5 & 0 \
          end{array}right]
          $$

          Then $f(A)=6$, $f(B)=6$, but $f(A+B) = 8 neq 6+6$.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            A filter is not necessarily linear. There exist many non-linear filters.
            $endgroup$
            – Cris Luengo
            Dec 16 '18 at 15:48










          • $begingroup$
            The question was asking about convolution. Convolution is distributive with respect to sums: en.wikipedia.org/wiki/Convolution#Algebraic_properties
            $endgroup$
            – Vincenzo
            Dec 16 '18 at 17:38










          • $begingroup$
            Yes, convolution is a linear filter. But it is likely that OP mentioned convolution because of unfamiliarity with non-linear filtering. OP calls the convolution kernel a filter.
            $endgroup$
            – Cris Luengo
            Dec 16 '18 at 17:51





















          0












          $begingroup$

          There is a sub-field if image processing called Mathematical Morphology. In this field, we focus on non-linear filters based on max and min operators.



          One of the basic filters is thus the dilation, a local maximum filter. Think of a convolution, but instead of multiplying kernel values to image values and adding up the results, we add kernel values to the image values and take the maximum of the result.



          With a kernel that is composed of only zeros, this turns into finding the maximum pixel value in a neighborhood.



          Using a 3x3 square neighborhood, we obtain the maximum value over the neighboring elements. Subtracting the input, we obtain the largest difference of a pixel with its neighbors.



          This difference is not symmetric. That is, if you invert the image by negating each pixel, you would get a different result. By adding in the opposite operation (erosion, a local minimum), it is possible to make the difference symmetric:



          $$ left( delta(f)-f right) vee left( f-epsilon(f) right)$$



          ($delta$ is the dilation, $epsilon$ is the erosion, $f$ is the image, and $vee$ is the supremum/maximum)






          share|cite|improve this answer









          $endgroup$













            Your Answer





            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("mathjaxEditing", function () {
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            });
            });
            }, "mathjax-editing");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "69"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            noCode: true, onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3036739%2ffilter-that-gives-the-max-change-in-matrix-value%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0












            $begingroup$

            No, because the function $f$ that you are interested in is a nonlinear function of the input matrix, while convolving matrices $A, B$ with a filter $F$ would always satisfy $$convolve(F, A+B) = convolve(F, A) + convolve(F, B).$$



            To see that the function you are interested in is nonlinear, consider the sum of two matrices
            $$ A+ B =
            left[begin{array}{ccc}
            0 & 0 & 0 \
            0 & -1 & 0 \
            0 & 5 & 0 \
            end{array}right] +
            left[begin{array}{ccc}
            0 & 4 & 0 \
            0 & -2 & 0 \
            0 & 0 & 0 \
            end{array}right] =
            left[begin{array}{ccc}
            0 & 4 & 0 \
            0 & -3 & 0 \
            0 & 5 & 0 \
            end{array}right]
            $$

            Then $f(A)=6$, $f(B)=6$, but $f(A+B) = 8 neq 6+6$.






            share|cite|improve this answer









            $endgroup$













            • $begingroup$
              A filter is not necessarily linear. There exist many non-linear filters.
              $endgroup$
              – Cris Luengo
              Dec 16 '18 at 15:48










            • $begingroup$
              The question was asking about convolution. Convolution is distributive with respect to sums: en.wikipedia.org/wiki/Convolution#Algebraic_properties
              $endgroup$
              – Vincenzo
              Dec 16 '18 at 17:38










            • $begingroup$
              Yes, convolution is a linear filter. But it is likely that OP mentioned convolution because of unfamiliarity with non-linear filtering. OP calls the convolution kernel a filter.
              $endgroup$
              – Cris Luengo
              Dec 16 '18 at 17:51


















            0












            $begingroup$

            No, because the function $f$ that you are interested in is a nonlinear function of the input matrix, while convolving matrices $A, B$ with a filter $F$ would always satisfy $$convolve(F, A+B) = convolve(F, A) + convolve(F, B).$$



            To see that the function you are interested in is nonlinear, consider the sum of two matrices
            $$ A+ B =
            left[begin{array}{ccc}
            0 & 0 & 0 \
            0 & -1 & 0 \
            0 & 5 & 0 \
            end{array}right] +
            left[begin{array}{ccc}
            0 & 4 & 0 \
            0 & -2 & 0 \
            0 & 0 & 0 \
            end{array}right] =
            left[begin{array}{ccc}
            0 & 4 & 0 \
            0 & -3 & 0 \
            0 & 5 & 0 \
            end{array}right]
            $$

            Then $f(A)=6$, $f(B)=6$, but $f(A+B) = 8 neq 6+6$.






            share|cite|improve this answer









            $endgroup$













            • $begingroup$
              A filter is not necessarily linear. There exist many non-linear filters.
              $endgroup$
              – Cris Luengo
              Dec 16 '18 at 15:48










            • $begingroup$
              The question was asking about convolution. Convolution is distributive with respect to sums: en.wikipedia.org/wiki/Convolution#Algebraic_properties
              $endgroup$
              – Vincenzo
              Dec 16 '18 at 17:38










            • $begingroup$
              Yes, convolution is a linear filter. But it is likely that OP mentioned convolution because of unfamiliarity with non-linear filtering. OP calls the convolution kernel a filter.
              $endgroup$
              – Cris Luengo
              Dec 16 '18 at 17:51
















            0












            0








            0





            $begingroup$

            No, because the function $f$ that you are interested in is a nonlinear function of the input matrix, while convolving matrices $A, B$ with a filter $F$ would always satisfy $$convolve(F, A+B) = convolve(F, A) + convolve(F, B).$$



            To see that the function you are interested in is nonlinear, consider the sum of two matrices
            $$ A+ B =
            left[begin{array}{ccc}
            0 & 0 & 0 \
            0 & -1 & 0 \
            0 & 5 & 0 \
            end{array}right] +
            left[begin{array}{ccc}
            0 & 4 & 0 \
            0 & -2 & 0 \
            0 & 0 & 0 \
            end{array}right] =
            left[begin{array}{ccc}
            0 & 4 & 0 \
            0 & -3 & 0 \
            0 & 5 & 0 \
            end{array}right]
            $$

            Then $f(A)=6$, $f(B)=6$, but $f(A+B) = 8 neq 6+6$.






            share|cite|improve this answer









            $endgroup$



            No, because the function $f$ that you are interested in is a nonlinear function of the input matrix, while convolving matrices $A, B$ with a filter $F$ would always satisfy $$convolve(F, A+B) = convolve(F, A) + convolve(F, B).$$



            To see that the function you are interested in is nonlinear, consider the sum of two matrices
            $$ A+ B =
            left[begin{array}{ccc}
            0 & 0 & 0 \
            0 & -1 & 0 \
            0 & 5 & 0 \
            end{array}right] +
            left[begin{array}{ccc}
            0 & 4 & 0 \
            0 & -2 & 0 \
            0 & 0 & 0 \
            end{array}right] =
            left[begin{array}{ccc}
            0 & 4 & 0 \
            0 & -3 & 0 \
            0 & 5 & 0 \
            end{array}right]
            $$

            Then $f(A)=6$, $f(B)=6$, but $f(A+B) = 8 neq 6+6$.







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered Dec 12 '18 at 14:53









            VincenzoVincenzo

            1916




            1916












            • $begingroup$
              A filter is not necessarily linear. There exist many non-linear filters.
              $endgroup$
              – Cris Luengo
              Dec 16 '18 at 15:48










            • $begingroup$
              The question was asking about convolution. Convolution is distributive with respect to sums: en.wikipedia.org/wiki/Convolution#Algebraic_properties
              $endgroup$
              – Vincenzo
              Dec 16 '18 at 17:38










            • $begingroup$
              Yes, convolution is a linear filter. But it is likely that OP mentioned convolution because of unfamiliarity with non-linear filtering. OP calls the convolution kernel a filter.
              $endgroup$
              – Cris Luengo
              Dec 16 '18 at 17:51




















            • $begingroup$
              A filter is not necessarily linear. There exist many non-linear filters.
              $endgroup$
              – Cris Luengo
              Dec 16 '18 at 15:48










            • $begingroup$
              The question was asking about convolution. Convolution is distributive with respect to sums: en.wikipedia.org/wiki/Convolution#Algebraic_properties
              $endgroup$
              – Vincenzo
              Dec 16 '18 at 17:38










            • $begingroup$
              Yes, convolution is a linear filter. But it is likely that OP mentioned convolution because of unfamiliarity with non-linear filtering. OP calls the convolution kernel a filter.
              $endgroup$
              – Cris Luengo
              Dec 16 '18 at 17:51


















            $begingroup$
            A filter is not necessarily linear. There exist many non-linear filters.
            $endgroup$
            – Cris Luengo
            Dec 16 '18 at 15:48




            $begingroup$
            A filter is not necessarily linear. There exist many non-linear filters.
            $endgroup$
            – Cris Luengo
            Dec 16 '18 at 15:48












            $begingroup$
            The question was asking about convolution. Convolution is distributive with respect to sums: en.wikipedia.org/wiki/Convolution#Algebraic_properties
            $endgroup$
            – Vincenzo
            Dec 16 '18 at 17:38




            $begingroup$
            The question was asking about convolution. Convolution is distributive with respect to sums: en.wikipedia.org/wiki/Convolution#Algebraic_properties
            $endgroup$
            – Vincenzo
            Dec 16 '18 at 17:38












            $begingroup$
            Yes, convolution is a linear filter. But it is likely that OP mentioned convolution because of unfamiliarity with non-linear filtering. OP calls the convolution kernel a filter.
            $endgroup$
            – Cris Luengo
            Dec 16 '18 at 17:51






            $begingroup$
            Yes, convolution is a linear filter. But it is likely that OP mentioned convolution because of unfamiliarity with non-linear filtering. OP calls the convolution kernel a filter.
            $endgroup$
            – Cris Luengo
            Dec 16 '18 at 17:51













            0












            $begingroup$

            There is a sub-field if image processing called Mathematical Morphology. In this field, we focus on non-linear filters based on max and min operators.



            One of the basic filters is thus the dilation, a local maximum filter. Think of a convolution, but instead of multiplying kernel values to image values and adding up the results, we add kernel values to the image values and take the maximum of the result.



            With a kernel that is composed of only zeros, this turns into finding the maximum pixel value in a neighborhood.



            Using a 3x3 square neighborhood, we obtain the maximum value over the neighboring elements. Subtracting the input, we obtain the largest difference of a pixel with its neighbors.



            This difference is not symmetric. That is, if you invert the image by negating each pixel, you would get a different result. By adding in the opposite operation (erosion, a local minimum), it is possible to make the difference symmetric:



            $$ left( delta(f)-f right) vee left( f-epsilon(f) right)$$



            ($delta$ is the dilation, $epsilon$ is the erosion, $f$ is the image, and $vee$ is the supremum/maximum)






            share|cite|improve this answer









            $endgroup$


















              0












              $begingroup$

              There is a sub-field if image processing called Mathematical Morphology. In this field, we focus on non-linear filters based on max and min operators.



              One of the basic filters is thus the dilation, a local maximum filter. Think of a convolution, but instead of multiplying kernel values to image values and adding up the results, we add kernel values to the image values and take the maximum of the result.



              With a kernel that is composed of only zeros, this turns into finding the maximum pixel value in a neighborhood.



              Using a 3x3 square neighborhood, we obtain the maximum value over the neighboring elements. Subtracting the input, we obtain the largest difference of a pixel with its neighbors.



              This difference is not symmetric. That is, if you invert the image by negating each pixel, you would get a different result. By adding in the opposite operation (erosion, a local minimum), it is possible to make the difference symmetric:



              $$ left( delta(f)-f right) vee left( f-epsilon(f) right)$$



              ($delta$ is the dilation, $epsilon$ is the erosion, $f$ is the image, and $vee$ is the supremum/maximum)






              share|cite|improve this answer









              $endgroup$
















                0












                0








                0





                $begingroup$

                There is a sub-field if image processing called Mathematical Morphology. In this field, we focus on non-linear filters based on max and min operators.



                One of the basic filters is thus the dilation, a local maximum filter. Think of a convolution, but instead of multiplying kernel values to image values and adding up the results, we add kernel values to the image values and take the maximum of the result.



                With a kernel that is composed of only zeros, this turns into finding the maximum pixel value in a neighborhood.



                Using a 3x3 square neighborhood, we obtain the maximum value over the neighboring elements. Subtracting the input, we obtain the largest difference of a pixel with its neighbors.



                This difference is not symmetric. That is, if you invert the image by negating each pixel, you would get a different result. By adding in the opposite operation (erosion, a local minimum), it is possible to make the difference symmetric:



                $$ left( delta(f)-f right) vee left( f-epsilon(f) right)$$



                ($delta$ is the dilation, $epsilon$ is the erosion, $f$ is the image, and $vee$ is the supremum/maximum)






                share|cite|improve this answer









                $endgroup$



                There is a sub-field if image processing called Mathematical Morphology. In this field, we focus on non-linear filters based on max and min operators.



                One of the basic filters is thus the dilation, a local maximum filter. Think of a convolution, but instead of multiplying kernel values to image values and adding up the results, we add kernel values to the image values and take the maximum of the result.



                With a kernel that is composed of only zeros, this turns into finding the maximum pixel value in a neighborhood.



                Using a 3x3 square neighborhood, we obtain the maximum value over the neighboring elements. Subtracting the input, we obtain the largest difference of a pixel with its neighbors.



                This difference is not symmetric. That is, if you invert the image by negating each pixel, you would get a different result. By adding in the opposite operation (erosion, a local minimum), it is possible to make the difference symmetric:



                $$ left( delta(f)-f right) vee left( f-epsilon(f) right)$$



                ($delta$ is the dilation, $epsilon$ is the erosion, $f$ is the image, and $vee$ is the supremum/maximum)







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered Dec 16 '18 at 15:58









                Cris LuengoCris Luengo

                1728




                1728






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Mathematics Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3036739%2ffilter-that-gives-the-max-change-in-matrix-value%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Plaza Victoria

                    In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                    How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...