Code Monkey home page Code Monkey logo

mosaic's Introduction

mosaic

Generate Roman style mosaics from input image using Python.

Edit mosaic.py to change path to your image and run. Tested with Python 3.9

example mosaic

mosaic's People

Contributors

yobeatz avatar

Stargazers

David Mendoza avatar Peter Pápay avatar  avatar  avatar Dušan Marcinko avatar Arturo Cáñez González avatar  avatar  avatar Asma avatar Michael Eisele avatar Amit Amola avatar Yufang Hao avatar James Adams avatar RJ Whitehead avatar Joao Camacho avatar  avatar Murat IŞIK avatar  avatar Sergey Utkin avatar pepe avatar  avatar Muhammad Abdullah avatar  avatar Mehdi Chaouch avatar Keep Growing And Moving Forward avatar hossein s. borhani avatar Natan avatar  avatar Attashe avatar Nopied◎ avatar Kevin Yonan avatar  avatar Aleksey Kuzmichev avatar  avatar Emilien Domenge avatar Marat Kopytjuk avatar  avatar  avatar Víctor Fernández avatar Chih Wang avatar André da Silva avatar Florian Klien avatar Sangeeth Kumar V avatar Daniel avatar Dennis avatar Sijie Chen avatar Dale Wyttenbach avatar Subin An avatar Tin Nguyen avatar Abhishesh Sharma avatar Andreas Steinvik avatar Russell Saerang avatar Lucas Aimaretto avatar

Watchers

Dave Proffer avatar JavierC avatar Sangeeth Kumar V avatar  avatar  avatar

mosaic's Issues

Where to put the input image

hello, can you please describe where to put the input image and where the output is saved or where i can see it? Thanks

How to remove Figure preview plots

Hi. I need apply this to picture folder, but code pause in plot preview per image. I need disable preview for direct save result . Please help me .. This problem in line 1 here
` svg = plotting.draw_tiles(polygons_post, colors, h,w, background_brightness=0.2, return_svg=False, chains=None)

Getting "No module named 'numpy'"

Hi,

I am getting:

File "/Users/john/Desktop/Mosaic/mosaic-main/edges.py", line 4, in
import numpy as np
ModuleNotFoundError: No module named 'numpy'

Can you help me here?

TypeError: 'MultiPolygon' object is not iterable

C:\Users\LENOVO\Desktop\mosaic-main>py mosaic.py
Size of input image: 600px * 900px
Estimated number of tiles: 1875
C:\Users\LENOVO\Desktop\mosaic-main\edges.py:108: FutureWarning: `multichannel` is a deprecated argument name for `gaussian`. It will be removed in version 1.0. Please use `channel_axis` instead.
  img = filters.gaussian(img, sigma=16, truncate=gauss/16, multichannel=True)
Pixel guidelines to chains with sorted points: 0.3s
Calculation of angle matrix: 0.9s
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
C:\Users\LENOVO\Desktop\mosaic-main\tiles.py:20: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
  if p.type not in ['MultiLineString','LineString', 'GeometryCollection']:
Traceback (most recent call last):
  File "C:\Users\LENOVO\Desktop\mosaic-main\mosaic.py", line 73, in <module>
    polygons_chains = tiles.place_tiles_along_chains(chains, angles_0to180, half_tile, RAND_SIZE, MAX_ANGLE, A0, plot=plot_list)
  File "C:\Users\LENOVO\Desktop\mosaic-main\tiles.py", line 88, in place_tiles_along_chains
    p = fit_in_polygon(p, nearby_polygons)
  File "C:\Users\LENOVO\Desktop\mosaic-main\tiles.py", line 17, in fit_in_polygon
    i_largest = np.argmax([p_i.area for p_i in p])
TypeError: 'MultiPolygon' object is not iterable

I did not change or modify anything. I am trying with default photo.
Python version: Python 3.10.7

Numpy Error, Import error

Good evening,

I am attempting to run this script and am getting the following error. I have added the file path into line 15

fname = r'C:\Users\kirsl\Desktop\Pompei for MK\download.jpg' # let empty for test image

and the script returns this error:

PS C:\Users\kirsl\Downloads\mosaic-main\mosaic-main> python mosaic.py
Traceback (most recent call last):
File "C:\Users\kirsl\Downloads\mosaic-main\mosaic-main\mosaic.py", line 12, in
import edges, guides, tiles, convex, coloring, plotting
File "C:\Users\kirsl\Downloads\mosaic-main\mosaic-main\edges.py", line 4, in
import numpy as np
ModuleNotFoundError: No module named 'numpy'

I see the issue is with two modules, however I am at a loss for what to do to resolve these issues. Could somebody offer some guidance?

multichannel error

Hey there, excited to use your code but a bit of a novice. I've gotten the following error that I cant seem to troubleshoot:

Exception has occurred: TypeError
gaussian() got an unexpected keyword argument 'multichannel'
File "C:\Users\cludg\OneDrive\Desktop\python\mosaic-main\edges.py", line 108, in edges_hed
img = filters.gaussian(img, sigma=16, truncate=gauss/16, multichannel=True)
File "C:\Users\cludg\OneDrive\Desktop\python\mosaic-main\mosaic.py", line 60, in
img_edges = edges.edges_hed(img0, gauss=GAUSS, plot=plot_list)
TypeError: gaussian() got an unexpected keyword argument 'multichannel'

any feedback would be appreciated!

CV2.error of wrong number of input channels

Hi Johannes! When I executed your code with my own figures, there will be an error popping out as shown below:

Size of input image: 645px * 899px
Estimated number of tiles: 2013
[ERROR:[email protected]] global /io/opencv/modules/dnn/src/dnn.cpp (3872) getLayerShapesRecursively OPENCV/DNN: [Convolution]:(conv1_1): getMemoryShapes() throws exception. inputs=1 outputs=0/1 blobs=2
[ERROR:[email protected]] global /io/opencv/modules/dnn/src/dnn.cpp (3878) getLayerShapesRecursively input[0] = [ 1 4 645 899 ]
[ERROR:[email protected]] global /io/opencv/modules/dnn/src/dnn.cpp (3886) getLayerShapesRecursively blobs[0] = CV_32FC1 [ 64 3 3 3 ]
[ERROR:[email protected]] global /io/opencv/modules/dnn/src/dnn.cpp (3886) getLayerShapesRecursively blobs[1] = CV_32FC1 [ 64 1 ]
[ERROR:[email protected]] global /io/opencv/modules/dnn/src/dnn.cpp (3888) getLayerShapesRecursively Exception message: OpenCV(4.5.5) /io/opencv/modules/dnn/src/layers/convolution_layer.cpp:404: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'getMemoryShapes'

Traceback (most recent call last):
File "./mosaic.py", line 60, in
img_edges = edges.edges_hed(img0, gauss=GAUSS, plot=plot_list)
File "/mnt/d/Dropbox/code/web-project/Mosaic/mosaic-main/edges.py", line 113, in edges_hed
hed_matrix = hed_edges(img)
File "/mnt/d/Dropbox/code/web-project/Mosaic/mosaic-main/edges.py", line 99, in hed_edges
out = net.forward()
cv2.error: OpenCV(4.5.5) /io/opencv/modules/dnn/src/layers/convolution_layer.cpp:404: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'getMemoryShapes'

I have searched on the internet, and still could not figure out how to solve it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.