Mercurial > forge
changeset 11686:9f74cc14b4e6 octave-forge
image: remove previously deprecated functions
* bmpwrite: removed (deprecated with 2.0.0)
* blkproc: removed (deprecated with 2.0.0)
* dilate: removed (deprecated with 2.0.0)
* erode: removed (deprecated with 2.0.0)
* NEWS: list of removed functions
author | carandraug |
---|---|
date | Sun, 05 May 2013 04:09:40 +0000 |
parents | 4c9ab739b7c8 |
children | 2c39ee206f66 |
files | main/image/NEWS main/image/inst/blkproc.m main/image/inst/bmpwrite.m main/image/inst/dilate.m main/image/inst/erode.m |
diffstat | 5 files changed, 4 insertions(+), 319 deletions(-) [+] |
line wrap: on
line diff
--- a/main/image/NEWS Sun May 05 04:04:40 2013 +0000 +++ b/main/image/NEWS Sun May 05 04:09:40 2013 +0000 @@ -20,6 +20,10 @@ iscolormap rgbplot + ** The following functions have been deprecated in the previous release + of the Image package and have now been removed: + + blkproc bmpwrite dilate erode ** The following functions have been deprecated (see their help text for the recommended alternatives):
--- a/main/image/inst/blkproc.m Sun May 05 04:04:40 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -## Copyright (C) 2004 Josep Mones i Teixidor -## -## This program is free software; you can redistribute it and/or modify it under -## the terms of the GNU General Public License as published by the Free Software -## Foundation; either version 3 of the License, or (at your option) any later -## version. -## -## This program is distributed in the hope that it will be useful, but WITHOUT -## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -## details. -## -## You should have received a copy of the GNU General Public License along with -## this program; if not, see <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {@var{B} = } blkproc (@var{A}, [@var{m},@var{n}], @var{fun}) -## This function has been deprecated. Please use @code{blockproc} instead which -## has exactly the same syntax. -## @end deftypefn - -function B = blkproc(A, varargin) - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "blkproc has been deprecated, and will be removed from future versions of the image package. Please use blockproc instead.") - endif - B = blockproc (A, varargin); -endfunction
--- a/main/image/inst/bmpwrite.m Sun May 05 04:04:40 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -## Author: Paul Kienzle <pkienzle@users.sf.net> -## This program is granted to the public domain. - -## -*- texinfo -*- -## @deftypefn {Function File} bmpwrite (@var{X}, @var{map}, @var{file}) -## Write the bitmap @var{X} into @var{file} (8-bit indexed uncompressed). -## -## @emph{warning}: @code{bmpwrite} has been deprecated in favor of -## @code{imwrite} in Octave core. This function will be removed from future -## versions of the 'image' package". -## -## The values in @var{X} are indices into the given RGB colour @var{map}. -## @deftypefnx{Function File} bmpwrite (@var{X}, @var{file}) -## Write the bitmap @var{X} into @var{file} (24-bit truecolor uncompressed). -## @var{X} is an m x n x 3 array of R,G,B integer values in the range 0 to 255. -## @end deftypefn - -function bmpwrite(x,colormap_or_file,file) - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "`bmpwrite' has been deprecated in favor of `imwrite' in Octave core. This function will be removed from future versions of the `image' package"); - endif - - if nargin==2 - bmpwrite_truecolor(x(:,:,1),x(:,:,2),x(:,:,3),colormap_or_file); - else - bmpwrite_indexed(x,colormap_or_file,file); - endif -endfunction - -function bmpwrite_truecolor(R,G,B,file) - h = rows(R); w = columns(R); - padw = ceil(3*w/4)*4-3*w; - header = 14+40; - filesize = header+h*(3*w+padw); - arch = "ieee-le"; - file = fopen(file, "wb"); - fwrite(file,toascii("BM"),"uchar",0,arch); # file tag - fwrite(file,filesize,"long",0,arch); # length of file - fwrite(file,0,"long",0,arch); # reserved - fwrite(file,header,"long",0,arch); # offset of raster data in file - - fwrite(file,40,"long",0,arch); # header size - fwrite(file,w,"long",0,arch); # image width - fwrite(file,h,"long",0,arch); # image height - fwrite(file,1,"short",0,arch); # number of planes - fwrite(file,24,"short",0,arch); # pixels per plane - fwrite(file,0,"long",0,arch); # compression (none) - fwrite(file,0,"long",0,arch); # compressed size of image - resolution = 72/2.54*100; # 72 dpi / 2.54 cm/in * 100 cm/m - fwrite(file,resolution,"long",0,arch); # horizontal resolution - fwrite(file,resolution,"long",0,arch); # vertical resolution - fwrite(file,0,"long",0,arch); # number of colours used - fwrite(file,0,"long",0,arch); # number of "important" colors - - ## raster image, lines written bottom to top. - R = R(end:-1:1,:)'; - G = G(end:-1:1,:)'; - B = B(end:-1:1,:)'; - RGB=[B(:),G(:),R(:)]'; # Now [[B;G;R],[B;G;R],...,[B;G;R]] - RGB=reshape(RGB,3*w,h); # Now [[B;G;R;...;B;G;R],...,[B;G;R;...;B;G;R]] - fwrite(file,[RGB;zeros(padw,h)],"uchar",0,arch); - fclose(file); -endfunction - -function bmpwrite_indexed(x,map,file) - - if rows(map) > 256, - bmpwrite_truecolor(reshape(map(x,1),size(x))*255, - reshape(map(x,2),size(x))*255, - reshape(map(x,3),size(x))*255, - file); - return; - endif - [h,w] = size(x); - padw = ceil(w/4)*4-w; - header = 14+40+4*rows(map); - filesize = header+(w+padw)*h; - arch = "ieee-le"; - file = fopen(file, "wb"); - fwrite(file,toascii("BM"),"uchar",0,arch); # file tag - fwrite(file,filesize,"long",0,arch); # length of file - fwrite(file,0,"long",0,arch); # reserved - fwrite(file,header,"long",0,arch); # offset of raster data in file - - fwrite(file,40,"long",0,arch); # header size - fwrite(file,w,"long",0,arch); # image width - fwrite(file,h,"long",0,arch); # image height - fwrite(file,1,"short",0,arch); # number of planes - fwrite(file,8,"short",0,arch); # pixels per plane - fwrite(file,0,"long",0,arch); # compression (none) - fwrite(file,0,"long",0,arch); # compressed size of image - resolution = 72/2.54*100; # 72 dpi / 2.54 cm/in * 100 cm/m - fwrite(file,resolution,"long",0,arch); # horizontal resolution - fwrite(file,resolution,"long",0,arch); # vertical resolution - fwrite(file,rows(map),"long",0,arch); # number of colours used - fwrite(file,0,"long",0,arch); # number of "important" colors - - ## colormap BGR0BGR0BGR0BGR0... - map=[round(map*255), zeros(rows(map),1)]; - map=map(:,[3,2,1,4]); - fwrite(file,map',"uchar",0,arch); - - ## raster image, each line on a 32-bit boundary, padded with zeros - ## lines written bottom to top. - fwrite(file,[flipud(x-1)';zeros(padw,h)],"uchar",0,arch); - fclose(file); -endfunction
--- a/main/image/inst/dilate.m Sun May 05 04:04:40 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -## Copyright (C) 2004 Josep Mones i Teixidor <jmones@puntbarra.com> -## -## This program is free software; you can redistribute it and/or modify it under -## the terms of the GNU General Public License as published by the Free Software -## Foundation; either version 3 of the License, or (at your option) any later -## version. -## -## This program is distributed in the hope that it will be useful, but WITHOUT -## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -## details. -## -## You should have received a copy of the GNU General Public License along with -## this program; if not, see <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {@var{BW2} =} dilate (@var{BW1}, @var{SE}) -## @deftypefnx {Function File} {@var{BW2} =} dilate (@var{BW1}, @var{SE}, @var{alg}) -## @deftypefnx {Function File} {@var{BW2} =} dilate (@var{BW1}, @var{SE}, @dots{}, @var{n}) -## Perform a dilation morphological operation on a binary image. -## -## @emph{warning}: @code{dilate} has been deprecated in favor of -## @code{imdilate}. This function will be removed from future versions of the -## 'image' package". -## -## BW2 = dilate(BW1, SE) returns a binary image with the result of a dilation -## operation on @var{BW1} using neighbour mask @var{SE}. -## -## For each point in @var{BW1}, dilate search its neighbours (which are -## defined by setting to 1 their in @var{SE}). If any of its neighbours -## is on (1), then pixel is set to 1. If all are off (0) then it is set to 0. -## -## Center of @var{SE} is calculated using floor((size(@var{SE})+1)/2). -## -## Pixels outside the image are considered to be 0. -## -## BW2 = dilate(BW1, SE, alg) returns the result of a dilation operation -## using algorithm @var{alg}. Only 'spatial' is implemented at the moment. -## -## BW2 = dilate(BW1, SE, @dots{}, n) returns the result of @var{n} dilation -## operations on @var{BW1}. -## -## @seealso{erode} -## @end deftypefn - -function BW2 = dilate (BW1, SE, a, b) - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "`dilate' has been deprecated in favor of `imdilate'. This function will be removed from future versions of the `image' package"); - endif - - alg='spatial'; - n=1; - if (nargin < 1 || nargin > 4) - print_usage; - endif - if nargin == 4 - alg=a; - n=b; - elseif nargin == 3 - if ischar(a) - alg=a; - else - n=a; - endif - endif - - if !strcmp(alg, 'spatial') - error("dilate: alg not implemented."); - endif - - # "Binarize" BW1, just in case image is not [1,0] - BW1=BW1!=0; - - ## Filtering must be done with the reflection of the structuring element (they - ## are not always symmetrical) - SE = imrotate(SE, 180); - for i=1:n - # create result matrix - BW1=filter2(SE,BW1)>0; - endfor - - BW2=BW1; -endfunction
--- a/main/image/inst/erode.m Sun May 05 04:04:40 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -## Copyright (C) 2004 Josep Mones i Teixidor <jmones@puntbarra.com> -## -## This program is free software; you can redistribute it and/or modify it under -## the terms of the GNU General Public License as published by the Free Software -## Foundation; either version 3 of the License, or (at your option) any later -## version. -## -## This program is distributed in the hope that it will be useful, but WITHOUT -## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -## details. -## -## You should have received a copy of the GNU General Public License along with -## this program; if not, see <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {@var{BW2} =} erode (@var{BW1}, @var{SE}) -## @deftypefnx {Function File} {@var{BW2} =} erode (@var{BW1}, @var{SE}, @var{alg}) -## @deftypefnx {Function File} {@var{BW2} =} erode (@var{BW1}, @var{SE}, @dots{}, @var{n}) -## Perform an erosion morphological operation on a binary image. -## -## @emph{warning}: @code{erode} has been deprecated in favor of -## @code{imerode}. This function will be removed from future versions of the -## 'image' package". -## -## BW2 = erosion(BW1, SE) returns a binary image with the result of an erosion -## operation on @var{BW1} using neighbour mask @var{SE}. -## -## For each point in @var{BW1}, erode searchs its neighbours (which are -## defined by setting to 1 their in @var{SE}). If all neighbours -## are on (1), then pixel is set to 1. If any is off (0) then it is set to 0. -## -## Center of @var{SE} is calculated using floor((size(@var{SE})+1)/2). -## -## Pixels outside the image are considered to be 0. -## -## BW2 = erode(BW1, SE, alg) returns the result of a erosion operation -## using algorithm @var{alg}. Only 'spatial' is implemented at the moment. -## -## BW2 = erosion(BW1, SE, @dots{}, n) returns the result of @var{n} erosion -## operations on @var{BW1}. -## -## @seealso{dilate} -## @end deftypefn - -function BW2 = erode (BW1, SE, a, b) - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "`erode' has been deprecated in favor of `imerode'. This function will be removed from future versions of the `image' package"); - endif - - alg='spatial'; - n=1; - if (nargin < 1 || nargin > 4) - print_usage; - endif - if nargin == 4 - alg=a; - n=b; - elseif nargin == 3 - if ischar(a) - alg=a; - else - n=a; - endif - endif - - if !strcmp(alg, 'spatial') - error("erode: alg not implemented."); - endif - - # count ones in mask - thr=sum(SE(:)); - - # "Binarize" BW1, just in case image is not [1,0] - BW1=BW1!=0; - - for i=1:n - # create result matrix - BW1=filter2(SE,BW1) == thr; - endfor - - BW2=BW1; -endfunction - -%!demo -%! erode(ones(5,5),ones(3,3)) -%! % creates a zeros border around ones. - -%!assert(erode([0,1,0;1,1,1;0,1,0],[0,0,0;0,0,1;0,1,1])==[1,0,0;0,0,0;0,0,0]); -%!assert(erode([0,1,0;1,1,1;0,1,0],[0,1;1,1])==[1,0,0;0,0,0;0,0,0]);