# stretch: stretch circle to square In bwimage: Describe Image Patterns in Natural Structures

## Description

Stretch data from circular image to square in binary matrix

## Usage

 `1` ```stretch(imagematrix, method = "radial") ```

## Arguments

 `imagematrix` The matrix to be stretched. `method` Stretch algorithm. Four algorithms (radial, shirley, squircle, and elliptical) are available to stretch the image. The algorithms were adapted from Lambers 2016.

## Value

A matrix of 0, 1 and NA representing white, black and transparent pixels, respectively.

## Author(s)

Carlos Biagolini-Jr.

## References

Lambers 2016 Mappings between Sphere, Disc, and Square. Journal of Computer Graphics Techniques, 5(2): 1-21.

## Examples

 ```1 2 3``` ```img_location <- system.file("extdata/chesstable.png",package ="bwimage") image_matrix<- threshold_color(img_location,"png", "frame_fixed",target_width = 50,target_height=50) stretch(image_matrix,method="radial") ```

### Example output

```sh: 1: cannot create /dev/null: Permission denied

|
|                                                                      |   0%
|
|=                                                                     |   2%
|
|===                                                                   |   4%
|
|====                                                                  |   6%
|
|======                                                                |   8%
|
|=======                                                               |  10%
|
|========                                                              |  12%
|
|==========                                                            |  14%
|
|===========                                                           |  16%
|
|=============                                                         |  18%
|
|==============                                                        |  20%
|
|===============                                                       |  22%
|
|=================                                                     |  24%
|
|==================                                                    |  26%
|
|====================                                                  |  28%
|
|=====================                                                 |  30%
|
|======================                                                |  32%
|
|========================                                              |  34%
|
|=========================                                             |  36%
|
|===========================                                           |  38%
|
|============================                                          |  40%
|
|=============================                                         |  42%
|
|===============================                                       |  44%
|
|================================                                      |  46%
|
|==================================                                    |  48%
|
|===================================                                   |  50%
|
|====================================                                  |  52%
|
|======================================                                |  54%
|
|=======================================                               |  56%
|
|=========================================                             |  58%
|
|==========================================                            |  60%
|
|===========================================                           |  62%
|
|=============================================                         |  64%
|
|==============================================                        |  66%
|
|================================================                      |  68%
|
|=================================================                     |  70%
|
|==================================================                    |  72%
|
|====================================================                  |  74%
|
|=====================================================                 |  76%
|
|=======================================================               |  78%
|
|========================================================              |  80%
|
|=========================================================             |  82%
|
|===========================================================           |  84%
|
|============================================================          |  86%
|
|==============================================================        |  88%
|
|===============================================================       |  90%
|
|================================================================      |  92%
|
|==================================================================    |  94%
|
|===================================================================   |  96%
|
|===================================================================== |  98%
|
|======================================================================| 100%      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,]    0    0    0    1    1    1    1    1    1     1     1     0     0
[2,]    0    0    0    0    0    0    1    1    1     1     0     0     0
[3,]    0    0    0    0    0    0    0    0    0     1     0     0     0
[4,]    1    0    0    0    0    0    0    0    0     0     1     1     0
[5,]    1    0    0    0    0    0    0    0    0     1     1     1     1
[6,]    1    0    0    0    0    0    0    0    0     1     1     1     1
[7,]    1    1    0    0    0    0    0    0    1     1     1     1     1
[8,]    1    1    0    0    0    0    0    0    1     1     1     1     1
[9,]    1    1    0    0    0    0    1    1    0     0     1     1     1
[10,]    1    1    1    0    1    1    1    1    0     0     0     0     0
[11,]    1    0    0    1    1    1    1    1    1     0     0     0     0
[12,]    0    0    0    1    1    1    1    1    1     0     0     0     0
[13,]    0    0    0    0    1    1    1    1    1     0     0     0     0
[14,]    0    0    0    0    1    1    1    1    1     1     0     0     0
[15,]    0    0    0    0    1    1    1    1    1     1     0     0     0
[16,]    0    0    0    0    0    1    1    1    1     1     0     0     0
[17,]    0    0    0    0    0    1    1    1    1     1     1     0     0
[18,]    0    0    0    0    0    1    1    1    1     1     1     0     0
[19,]    1    1    1    1    1    1    0    0    0     0     0     1     1
[20,]    1    1    1    1    1    1    0    0    0     0     0     0     1
[21,]    1    1    1    1    1    1    0    0    0     0     0     0     1
[22,]    1    1    1    1    1    1    0    0    0     0     0     0     1
[23,]    1    1    1    1    1    1    0    0    0     0     0     0     1
[24,]    1    1    1    1    1    1    0    0    0     0     0     0     1
[25,]    1    1    1    1    1    1    0    0    0     0     0     0     1
[26,]    1    1    1    1    1    1    0    0    0     0     0     0     1
[27,]    0    0    0    0    0    0    1    1    1     1     1     1     0
[28,]    0    0    0    0    0    0    1    1    1     1     1     1     0
[29,]    0    0    0    0    0    0    1    1    1     1     1     1     0
[30,]    0    0    0    0    0    0    1    1    1     1     1     1     0
[31,]    0    0    0    0    0    0    1    1    1     1     1     0     0
[32,]    0    0    0    0    0    1    1    1    1     1     1     0     0
[33,]    1    1    1    1    1    0    0    0    0     0     1     0     0
[34,]    1    1    1    1    1    0    0    0    0     0     1     1     1
[35,]    1    1    1    1    0    0    0    0    0     0     1     1     1
[36,]    1    1    1    1    0    0    0    0    0     0     1     1     1
[37,]    1    1    1    1    0    0    0    0    0     1     1     1     1
[38,]    1    1    1    0    0    0    0    0    0     1     1     1     1
[39,]    1    1    1    0    0    0    0    0    0     1     1     1     1
[40,]    1    1    1    0    0    0    0    0    1     1     1     1     1
[41,]    0    0    0    0    0    0    0    0    1     1     1     1     1
[42,]    0    0    1    1    0    0    0    0    1     1     0     0     0
[43,]    0    0    1    1    1    1    0    1    0     0     0     0     0
[44,]    0    1    1    1    1    1    1    1    1     0     0     0     0
[45,]    0    1    1    1    1    1    1    1    1     0     0     0     0
[46,]    0    1    1    1    1    1    1    1    1     1     0     0     0
[47,]    1    1    1    1    1    1    1    1    1     1     0     0     1
[48,]    1    1    1    1    1    1    1    1    1     0     1     1     1
[49,]    1    1    1    1    1    1    0    0    0     0     0     1     1
[50,]    1    1    1    0    0    0    0    0    0     0     0     1     1
[,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
[1,]     0     0     0     0     0     1     1     1     1     1     1     1
[2,]     0     0     0     0     0     1     1     1     1     1     1     1
[3,]     0     0     0     0     0     1     1     1     1     1     1     1
[4,]     0     0     0     0     0     1     1     1     1     1     1     1
[5,]     1     1     0     0     0     1     1     1     1     1     1     1
[6,]     1     1     1     1     1     1     1     1     1     1     1     1
[7,]     1     1     1     1     1     0     0     0     0     0     0     0
[8,]     1     1     1     1     1     0     0     0     0     0     0     0
[9,]     1     1     1     1     1     0     0     0     0     0     0     0
[10,]     1     1     1     1     1     0     0     0     0     0     0     0
[11,]     0     0     0     1     1     0     0     0     0     0     0     0
[12,]     0     0     0     0     0     1     0     0     0     0     0     0
[13,]     0     0     0     0     0     1     1     1     1     1     1     1
[14,]     0     0     0     0     1     1     1     1     1     1     1     1
[15,]     0     0     0     0     1     1     1     1     1     1     1     1
[16,]     0     0     0     1     1     1     1     1     1     1     1     1
[17,]     0     0     1     0     1     1     1     1     1     1     1     1
[18,]     1     1     1     1     0     0     0     1     1     1     1     1
[19,]     1     1     1     1     0     0     0     0     0     0     0     0
[20,]     1     1     1     1     0     0     0     0     0     0     0     0
[21,]     1     1     1     1     1     0     0     0     0     0     0     0
[22,]     1     1     1     1     1     0     0     0     0     0     0     0
[23,]     1     1     1     1     1     0     0     0     0     0     0     0
[24,]     1     1     1     1     1     0     0     0     0     0     0     0
[25,]     1     1     1     1     1     0     0     0     0     0     0     0
[26,]     1     1     1     1     1     0     0     0     0     0     0     1
[27,]     0     0     0     0     0     1     1     1     1     1     1     1
[28,]     0     0     0     0     0     1     1     1     1     1     1     1
[29,]     0     0     0     0     0     1     1     1     1     1     1     1
[30,]     0     0     0     0     1     1     1     1     1     1     1     1
[31,]     0     0     0     0     1     1     1     1     1     1     1     1
[32,]     0     0     0     0     1     1     1     1     1     1     1     0
[33,]     0     0     0     1     1     1     1     0     0     0     0     0
[34,]     0     0     0     1     0     0     0     0     0     0     0     0
[35,]     1     1     1     1     0     0     0     0     0     0     0     0
[36,]     1     1     1     1     0     0     0     0     0     0     0     0
[37,]     1     1     1     1     1     0     0     0     0     0     0     0
[38,]     1     1     1     1     1     0     0     0     0     0     0     1
[39,]     1     1     1     1     1     0     1     1     1     1     1     1
[40,]     1     1     1     0     0     1     1     1     1     1     1     1
[41,]     0     0     0     0     0     1     1     1     1     1     1     1
[42,]     0     0     0     0     0     1     1     1     1     1     1     1
[43,]     0     0     0     0     0     1     1     1     1     1     1     1
[44,]     0     0     0     0     0     1     1     1     1     1     1     0
[45,]     0     0     0     0     0     0     0     0     0     0     0     0
[46,]     0     0     1     1     1     0     0     0     0     0     0     0
[47,]     1     1     1     1     1     0     0     0     0     0     0     0
[48,]     1     1     1     1     1     0     0     0     0     0     0     0
[49,]     1     1     1     1     1     0     0     0     0     0     0     0
[50,]     1     1     1     1     1     0     0     0     0     0     0     0
[,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37]
[1,]     1     0     0     0     0     0     0     1     1     1     1     1
[2,]     1     0     0     0     0     0     0     1     1     1     1     1
[3,]     1     0     0     0     0     0     0     1     1     1     1     1
[4,]     1     0     0     0     0     0     0     1     1     1     1     1
[5,]     1     0     0     0     0     0     0     1     1     0     0     0
[6,]     1     0     0     0     0     0     1     0     0     0     0     0
[7,]     0     1     1     1     1     1     1     0     0     0     0     0
[8,]     0     1     1     1     1     1     1     0     0     0     0     0
[9,]     0     1     1     1     1     1     1     0     0     0     0     0
[10,]     0     1     1     1     1     1     1     0     0     0     0     1
[11,]     0     1     1     1     1     1     1     1     1     1     1     1
[12,]     0     1     1     1     1     0     0     0     1     1     1     1
[13,]     1     0     0     0     0     0     0     0     1     1     1     1
[14,]     1     0     0     0     0     0     0     0     0     1     1     1
[15,]     1     0     0     0     0     0     0     0     0     1     1     1
[16,]     1     0     0     0     0     0     0     0     0     1     1     1
[17,]     1     0     0     0     0     0     0     1     1     1     1     1
[18,]     1     0     0     0     1     1     1     1     0     0     0     1
[19,]     0     1     1     1     1     1     1     1     0     0     0     0
[20,]     0     1     1     1     1     1     1     1     0     0     0     0
[21,]     0     1     1     1     1     1     1     0     0     0     0     0
[22,]     0     1     1     1     1     1     1     0     0     0     0     0
[23,]     0     1     1     1     1     1     1     0     0     0     0     0
[24,]     0     1     1     1     1     1     1     0     0     0     0     0
[25,]     1     1     1     1     1     1     0     0     0     0     0     0
[26,]     0     1     1     1     1     1     1     0     0     0     0     0
[27,]     1     0     0     0     0     0     0     1     1     1     1     1
[28,]     1     0     0     0     0     0     0     1     1     1     1     1
[29,]     1     0     0     0     0     0     0     1     1     1     1     1
[30,]     1     0     0     0     0     0     0     0     1     1     1     1
[31,]     1     0     0     0     0     0     0     0     1     1     1     1
[32,]     1     0     0     0     0     0     0     0     1     1     1     1
[33,]     0     1     1     1     0     0     0     0     0     1     1     1
[34,]     0     1     1     1     1     1     1     0     0     1     1     0
[35,]     0     1     1     1     1     1     1     1     1     0     0     0
[36,]     0     1     1     1     1     1     1     1     1     0     0     0
[37,]     0     1     1     1     1     1     1     1     0     0     0     0
[38,]     0     1     1     1     1     1     1     1     0     0     0     0
[39,]     1     0     0     0     0     1     1     1     0     0     0     0
[40,]     1     0     0     0     0     0     0     1     0     0     0     0
[41,]     1     0     0     0     0     0     0     1     1     1     1     0
[42,]     1     0     0     0     0     0     0     1     1     1     1     1
[43,]     1     0     0     0     0     0     0     1     1     1     1     1
[44,]     1     0     0     0     0     0     0     1     1     1     1     1
[45,]     0     1     1     1     1     1     0     1     1     1     1     1
[46,]     0     1     1     1     1     1     1     0     0     1     1     1
[47,]     0     1     1     1     1     1     1     0     0     0     0     0
[48,]     0     1     1     1     1     1     1     0     0     0     0     0
[49,]     0     1     1     1     1     1     1     0     0     0     0     0
[50,]     0     1     1     1     1     1     1     0     0     0     0     0
[,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49]
[1,]     1     1     1     0     0     0     0     0     0     1     1     1
[2,]     1     1     1     0     0     0     1     1     1     1     1     1
[3,]     1     1     1     0     1     1     1     1     1     1     1     1
[4,]     0     0     0     0     1     1     1     1     1     1     1     1
[5,]     0     0     0     0     0     1     1     1     1     1     1     1
[6,]     0     0     0     0     0     1     1     1     1     1     1     1
[7,]     0     0     0     0     0     0     1     1     1     1     1     0
[8,]     0     0     0     0     0     1     1     1     1     1     1     0
[9,]     0     0     1     1     1     0     1     1     1     1     1     0
[10,]     1     1     1     1     1     0     0     0     1     1     0     0
[11,]     1     1     1     1     0     0     0     0     0     0     1     0
[12,]     1     1     1     1     0     0     0     0     0     0     1     1
[13,]     1     1     1     1     0     0     0     0     0     1     1     1
[14,]     1     1     1     0     0     0     0     0     0     1     1     1
[15,]     1     1     1     0     0     0     0     0     0     1     1     1
[16,]     1     1     1     0     0     0     0     0     1     1     1     1
[17,]     1     1     0     0     0     0     0     0     1     1     1     1
[18,]     1     1     0     0     0     0     0     0     1     1     1     1
[19,]     0     0     1     1     1     1     1     0     0     0     0     0
[20,]     0     1     1     1     1     1     1     0     0     0     0     0
[21,]     0     1     1     1     1     1     1     0     0     0     0     0
[22,]     0     1     1     1     1     1     1     0     0     0     0     0
[23,]     0     1     1     1     1     1     1     0     0     0     0     0
[24,]     0     1     1     1     1     1     1     0     0     0     0     0
[25,]     1     1     1     1     1     1     0     0     0     0     0     0
[26,]     0     1     1     1     1     1     1     0     0     0     0     0
[27,]     1     0     0     0     0     0     0     1     1     1     1     1
[28,]     1     0     0     0     0     0     0     1     1     1     1     1
[29,]     1     0     0     0     0     0     0     1     1     1     1     1
[30,]     1     0     0     0     0     0     0     1     1     1     1     1
[31,]     1     1     0     0     0     0     0     1     1     1     1     1
[32,]     1     1     0     0     0     0     0     0     1     1     1     1
[33,]     1     1     1     1     1     1     1     1     0     0     0     0
[34,]     0     0     0     1     1     1     1     1     0     0     0     0
[35,]     0     0     0     1     1     1     1     1     1     0     0     0
[36,]     0     0     0     1     1     1     1     1     1     0     0     0
[37,]     0     0     0     0     1     1     1     1     1     0     0     0
[38,]     0     0     0     0     1     1     1     1     1     1     0     0
[39,]     0     0     0     0     1     1     1     1     1     1     0     0
[40,]     0     0     0     0     0     1     1     1     1     1     0     0
[41,]     0     0     0     0     0     1     1     1     1     1     0     1
[42,]     1     1     0     0     0     1     1     1     0     0     0     1
[43,]     1     1     1     1     1     0     0     0     0     0     0     1
[44,]     1     1     1     1     1     0     0     0     0     0     0     0
[45,]     1     1     1     1     1     0     0     0     0     0     0     0
[46,]     1     1     1     1     0     0     0     0     0     0     0     0
[47,]     1     1     1     1     0     0     0     0     0     0     0     0
[48,]     0     0     0     0     0     0     0     0     0     0     0     0
[49,]     0     0     0     1     1     1     0     0     0     0     0     0
[50,]     0     0     0     1     1     1     1     1     1     0     0     0
[,50]
[1,]     1
[2,]     1
[3,]     1
[4,]     0
[5,]     0
[6,]     0
[7,]     0
[8,]     0
[9,]     0
[10,]     0
[11,]     0
[12,]     1
[13,]     1
[14,]     1
[15,]     1
[16,]     1
[17,]     1
[18,]     1
[19,]     0
[20,]     0
[21,]     0
[22,]     0
[23,]     0
[24,]     0
[25,]     0
[26,]     0
[27,]     1
[28,]     1
[29,]     1
[30,]     1
[31,]     1
[32,]     1
[33,]     0
[34,]     0
[35,]     0
[36,]     0
[37,]     0
[38,]     0
[39,]     0
[40,]     0
[41,]     1
[42,]     1
[43,]     1
[44,]     1
[45,]     1
[46,]     1
[47,]     0
[48,]     0
[49,]     0
[50,]     0
```

bwimage documentation built on April 23, 2020, 1:06 a.m.