ajout images crop

This commit is contained in:
François Pelletier 2015-09-26 16:05:40 -04:00
parent 9111da909a
commit 358dd91c04
13 changed files with 324 additions and 37 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 KiB

View file

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 28,
"metadata": {
"collapsed": true
},
@ -14,14 +14,14 @@
"\n",
"from skimage import feature\n",
"from scipy import misc\n",
"fimg = misc.imread(\"contourV1.png\")\n",
"fimg = misc.imread(\"contourV1-cropped.png\")\n",
"\n",
"from skimage import measure"
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 29,
"metadata": {
"collapsed": false
},
@ -35,7 +35,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 30,
"metadata": {
"collapsed": false
},
@ -63,7 +63,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 31,
"metadata": {
"collapsed": false
},
@ -74,7 +74,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 32,
"metadata": {
"collapsed": false
},

View file

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 26,
"metadata": {
"collapsed": true
},
@ -13,18 +13,18 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 27,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"fimg = misc.imread(\"contourV1.png\")"
"fimg = misc.imread(\"contourV1-cropped.png\")"
]
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 28,
"metadata": {
"collapsed": true
},
@ -35,7 +35,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 29,
"metadata": {
"collapsed": true
},
@ -46,7 +46,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 30,
"metadata": {
"collapsed": true
},
@ -58,7 +58,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 31,
"metadata": {
"collapsed": true
},
@ -72,7 +72,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 32,
"metadata": {
"collapsed": false
},
@ -80,10 +80,10 @@
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x7f3b9eaa60d0>]"
"[<matplotlib.lines.Line2D at 0x7f3bb2307910>]"
]
},
"execution_count": 24,
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
@ -103,7 +103,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 33,
"metadata": {
"collapsed": false
},

View file

@ -1,6 +0,0 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
}

View file

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 28,
"metadata": {
"collapsed": true
},
@ -14,14 +14,14 @@
"\n",
"from skimage import feature\n",
"from scipy import misc\n",
"fimg = misc.imread(\"contourV1.png\")\n",
"fimg = misc.imread(\"contourV1-cropped.png\")\n",
"\n",
"from skimage import measure"
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 29,
"metadata": {
"collapsed": false
},
@ -35,7 +35,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 30,
"metadata": {
"collapsed": false
},
@ -63,18 +63,18 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 31,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"contours = measure.find_contours(gimg, 0.8)"
"contours = measure.find_contours(gimg, 0.9)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 32,
"metadata": {
"collapsed": false
},

View file

@ -0,0 +1,146 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from scipy import misc"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"fimg = misc.imread(\"contourV1-cropped.png\")"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from skimage import color"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"gimg = color.colorconv.rgb2grey(fimg)"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from skimage import measure\n",
"contours = measure.find_contours(gimg, 0.8)"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
" \n",
"for n, contour in enumerate(contours):\n",
" plt.plot(contour[:, 1], contour[:, 0], linewidth=2)"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x7f3bb2307910>]"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from skimage.draw import ellipse\n",
"from skimage.measure import find_contours, approximate_polygon, subdivide_polygon\n",
" \n",
"contour = contours[0]\n",
"new_s = contour.copy()\n",
"appr_s = approximate_polygon(new_s, tolerance=0.8)\n",
" \n",
"fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(9, 4))\n",
"ax2.plot(contour[:, 0], contour[:, 1])\n",
"ax1.plot(appr_s[:, 0], appr_s[:, 1])"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
}
},
"nbformat": 4,
"nbformat_minor": 0
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

View file

@ -1,19 +1,21 @@
library(ggplot2)
setwd("/home/francois/git/decouverte/Timeline")
timeset<-data.frame(year=c(1600,1900,1950,2015),
timeset<-data.frame(year=c(1800,1900,1950,2015),
text=c('Art ancien','Art moderne','Art contemporain','Aujourd\'hui'),
y=0)
plot <- ggplot(timeset,aes(x=year,y=0)) +
geom_segment(aes(y=0,yend=y,xend=year)) +
geom_text(aes(label=text),size=2.5,vjust=-1) +
geom_text(aes(label=text),size=5,vjust=1.5, fontface=3) +
geom_point(aes(y=y)) +
scale_y_continuous(limits=c(-.25,.25)) +
geom_hline(y=0,size=1,color='purple') +
theme(axis.text.y = element_blank()) +
ylab('') +
xlab('')
scale_x_continuous(limits=c(1775,2025)) +
geom_hline(y=0,size=1,color='dark green') +
theme(axis.text.y = element_blank()) + ylab("")+xlab("")
png(height=100)
png(height=200, width=800)
plot
dev.off()

5
extraction_donnees.R Normal file
View file

@ -0,0 +1,5 @@
donnees_mnbaq <- read.csv(file="/home/francois/git/decouverte/mnbaq_collections_septembre_2015.csv",header=TRUE,sep=";")
donnees_oeuvre <- donnees_mnbaq[donnees_mnbaq$Numéro.d.inventaire == "1989.295.08",c("Artiste","Titre","Date.de.production")]
xtable(as.data.frame)

21
extraction_donnees.Rmd Normal file
View file

@ -0,0 +1,21 @@
# Données de MNBAQ
```{r}
require("xtable")
```
## Extraction des données
```{r}
donnees_mnbaq <- read.csv(file="/home/francois/git/mnbaq_collections_septembre_2015.csv",header=TRUE,sep=";")
donnees_oeuvre <- donnees_mnbaq[donnees_mnbaq$Numéro.d.inventaire == "1989.295.08",c("Artiste","Titre","Date.de.production","Collection")]
```
## Présentation des données
```{r results='asis'}
print(xtable(donnees_oeuvre),type="html")
```
## Extraction de l'image
![oeuvre](https://d2bkax9t3zigfp.cloudfront.net/attachments/000/122/513/normal/bc275d82a7a748296ebccb69af5844c3?v=1)

119
extraction_donnees.html Normal file

File diff suppressed because one or more lines are too long